Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
fzf
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to JiHu GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
KMSCAKKSCFKA AKFACAMADCAS
fzf
Commits
9516fe33
Unverified
Commit
9516fe33
authored
7 years ago
by
Junegunn Choi
Browse files
Options
Downloads
Patches
Plain Diff
[install] Add --no-{bash,zsh,fish}
Close #1040
parent
20cdbac8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
install
+26
-8
26 additions, 8 deletions
install
with
26 additions
and
8 deletions
install
+
26
−
8
View file @
9516fe33
...
...
@@ -8,6 +8,7 @@ key_bindings=
update_config
=
2
binary_arch
=
allow_legacy
=
shells
=
"bash zsh fish"
help
()
{
cat
<<
EOF
...
...
@@ -21,6 +22,10 @@ usage: $0 [OPTIONS]
--[no-]completion Enable/disable fuzzy completion (bash & zsh)
--[no-]update-rc Whether or not to update shell configuration files
--no-bash Do not set up bash configuration
--no-zsh Do not set up zsh configuration
--no-fish Do not set up fish configuration
--32 Download 32-bit binary
--64 Download 64-bit binary
EOF
...
...
@@ -47,6 +52,9 @@ for opt in "$@"; do
--32
)
binary_arch
=
386
;;
--64
)
binary_arch
=
amd64
;;
--bin
)
;;
--no-bash
)
shells
=
${
shells
/bash/
}
;;
--no-zsh
)
shells
=
${
shells
/zsh/
}
;;
--no-fish
)
shells
=
${
shells
/fish/
}
;;
*
)
echo
"unknown option:
$opt
"
help
...
...
@@ -204,6 +212,17 @@ fi
[[
"
$*
"
=
~
"--bin"
]]
&&
exit
0
for
s
in
$shells
;
do
if
!
command
-v
"
$s
"
>
/dev/null
;
then
shells
=
${
shells
/
$s
/
}
fi
done
if
[[
${#
shells
}
-lt
3
]]
;
then
echo
"No shell configuration to be updated."
exit
0
fi
# Auto-completion
if
[
-z
"
$auto_completion
"
]
;
then
ask
"Do you want to enable fuzzy auto-completion?"
...
...
@@ -217,9 +236,8 @@ if [ -z "$key_bindings" ]; then
fi
echo
has_zsh
=
$(
command
-v
zsh
>
/dev/null
&&
echo
1
||
echo
0
)
shells
=
$(
[
$has_zsh
-eq
1
]
&&
echo
"bash zsh"
||
echo
"bash"
)
for
shell
in
$shells
;
do
[[
"
$shell
"
=
fish
]]
&&
continue
echo
-n
"Generate ~/.fzf.
$shell
... "
src
=
~/.fzf.
${
shell
}
...
...
@@ -253,8 +271,7 @@ EOF
done
# fish
has_fish
=
$(
command
-v
fish
>
/dev/null
&&
echo
1
||
echo
0
)
if
[
$has_fish
-eq
1
]
;
then
if
[[
"
$shells
"
=
~ fish
]]
;
then
echo
-n
"Update fish_user_paths ... "
fish
<<
EOF
echo
\$
fish_user_paths |
\g
rep
$fzf_base
/bin > /dev/null
...
...
@@ -330,11 +347,12 @@ if [ $update_config -eq 2 ]; then
fi
echo
for
shell
in
$shells
;
do
[[
"
$shell
"
=
fish
]]
&&
continue
[
$shell
=
zsh
]
&&
dest
=
${
ZDOTDIR
:-
~
}
/.zshrc
||
dest
=
~/.bashrc
append_line
$update_config
"[ -f ~/.fzf.
${
shell
}
] && source ~/.fzf.
${
shell
}
"
"
$dest
"
"~/.fzf.
${
shell
}
"
done
if
[
$key_bindings
-eq
1
]
&&
[
$has_fish
-eq
1
]
;
then
if
[
$key_bindings
-eq
1
]
&&
[
[
"
$shells
"
=
~ fish
]
]
;
then
bind_file
=
~/.config/fish/functions/fish_user_key_bindings.fish
if
[
!
-e
"
$bind_file
"
]
;
then
create_file
"
$bind_file
"
\
...
...
@@ -348,9 +366,9 @@ fi
if
[
$update_config
-eq
1
]
;
then
echo
'Finished. Restart your shell or reload config file.'
echo
' source ~/.bashrc # bash'
[
$has_zsh
-eq
1
]
&&
echo
" source
${
ZDOTDIR
:-
~
}
/.zshrc # zsh"
[
$has_fish
-eq
1
]
&&
[
$key_bindings
-eq
1
]
&&
echo
' fzf_key_bindings # fish'
[[
"
$shells
"
=
~ bash
]]
&&
echo
' source ~/.bashrc # bash'
[
[
"
$shells
"
=
~ zsh
]]
&&
echo
" source
${
ZDOTDIR
:-
~
}
/.zshrc # zsh"
[
[
"
$shells
"
=
~ fish
]
]
&&
[
$key_bindings
-eq
1
]
&&
echo
' fzf_key_bindings # fish'
echo
echo
'Use uninstall script to remove fzf.'
echo
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment