Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
oh-my-zsh
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
github
oh-my-zsh
Commits
010c36d4
Unverified
Commit
010c36d4
authored
Dec 17, 2021
by
Logan Linn
Committed by
GitHub
Dec 17, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor(fzf): adopt code style and simplify function naming (#10514)
parent
41c15a21
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
152 additions
and
152 deletions
+152
-152
fzf.plugin.zsh
plugins/fzf/fzf.plugin.zsh
+152
-152
No files found.
plugins/fzf/fzf.plugin.zsh
View file @
010c36d4
function
setup_using_base_dir
()
{
function
fzf_
setup_using_base_dir
()
{
local
fzf_base fzf_shell fzfdirs
dir
local
fzf_base fzf_shell fzfdirs
dir
test
-d
"
${
FZF_BASE
}
"
&&
fzf_base
=
"
${
FZF_BASE
}
"
test
-d
"
${
FZF_BASE
}
"
&&
fzf_base
=
"
${
FZF_BASE
}
"
...
@@ -58,7 +58,7 @@ function setup_using_base_dir() {
...
@@ -58,7 +58,7 @@ function setup_using_base_dir() {
}
}
function
setup_using_debian_package
()
{
function
fzf_setup_using_debian
()
{
if
((
!
$+
commands[dpkg]
))
||
!
dpkg
-s
fzf &>/dev/null
;
then
if
((
!
$+
commands[dpkg]
))
||
!
dpkg
-s
fzf &>/dev/null
;
then
# Either not a debian based distro, or no fzf installed
# Either not a debian based distro, or no fzf installed
return
1
return
1
...
@@ -96,7 +96,7 @@ function setup_using_debian_package() {
...
@@ -96,7 +96,7 @@ function setup_using_debian_package() {
return
0
return
0
}
}
function
setup_using_opensuse_packag
e
()
{
function
fzf_setup_using_opensus
e
()
{
# OpenSUSE installs fzf in /usr/bin/fzf
# OpenSUSE installs fzf in /usr/bin/fzf
# If the command is not found, the package isn't installed
# If the command is not found, the package isn't installed
((
$+
commands[fzf]
))
||
return
1
((
$+
commands[fzf]
))
||
return
1
...
@@ -125,7 +125,7 @@ function setup_using_opensuse_package() {
...
@@ -125,7 +125,7 @@ function setup_using_opensuse_package() {
return
0
return
0
}
}
function
setup_using_openbsd_package
()
{
function
fzf_setup_using_openbsd
()
{
# openBSD installs fzf in /usr/local/bin/fzf
# openBSD installs fzf in /usr/local/bin/fzf
if
[[
"
$OSTYPE
"
!=
openbsd
*
]]
||
((
!
$+
commands[fzf]
))
;
then
if
[[
"
$OSTYPE
"
!=
openbsd
*
]]
||
((
!
$+
commands[fzf]
))
;
then
return
1
return
1
...
@@ -149,21 +149,21 @@ function setup_using_openbsd_package() {
...
@@ -149,21 +149,21 @@ function setup_using_openbsd_package() {
return
0
return
0
}
}
function
indicate_error
()
{
# Indicate to user that fzf installation not found if nothing worked
cat
>
&2
<<
EOF
function
fzf_setup_error
()
{
cat
>
&2
<<
'
EOF
'
[oh-my-zsh] fzf plugin: Cannot find fzf installation directory.
[oh-my-zsh] fzf plugin: Cannot find fzf installation directory.
Please add
\`export FZF_BASE=/path/to/fzf/install/dir\
` to your .zshrc
Please add
`export FZF_BASE=/path/to/fzf/install/dir
` to your .zshrc
EOF
EOF
}
}
# Indicate to user that fzf installation not found if nothing worked
fzf_setup_using_openbsd
\
setup_using_openbsd_package
\
||
fzf_setup_using_debian
\
||
setup_using_debian_package
\
||
fzf_setup_using_opensuse
\
||
setup_using_opensuse_package
\
||
fzf_setup_using_base_dir
\
||
setup_using_base_dir
\
||
fzf_setup_error
||
indicate_error
unset
-f
setup_using_opensuse_package setup_using_debian_package setup_using_base_dir indicate_error
unset
-f
-m
'fzf_setup_*'
if
[[
-z
"
$FZF_DEFAULT_COMMAND
"
]]
;
then
if
[[
-z
"
$FZF_DEFAULT_COMMAND
"
]]
;
then
if
((
$+
commands[rg]
))
;
then
if
((
$+
commands[rg]
))
;
then
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment