mirror of
https://github.com/Llewellynvdm/fzf.git
synced 2025-01-07 00:53:57 +00:00
[fish] Fix ~/.config/fish/functions/fish_user_key_bindings.fish
Install script will create the file with the proper function body only if the file doesn't exist. If it already exists, it will try to append `fzf_key_bindings` as before. Close #851
This commit is contained in:
parent
7a11a06cbd
commit
5677e5e133
20
install
20
install
@ -297,6 +297,17 @@ append_line() {
|
|||||||
set +e
|
set +e
|
||||||
}
|
}
|
||||||
|
|
||||||
|
create_file() {
|
||||||
|
local file="$1"
|
||||||
|
shift
|
||||||
|
echo "Create $file:"
|
||||||
|
for line in "$@"; do
|
||||||
|
echo " $line"
|
||||||
|
echo "$line" >> "$file"
|
||||||
|
done
|
||||||
|
echo
|
||||||
|
}
|
||||||
|
|
||||||
if [ $update_config -eq 2 ]; then
|
if [ $update_config -eq 2 ]; then
|
||||||
echo
|
echo
|
||||||
ask "Do you want to update your shell configuration files?"
|
ask "Do you want to update your shell configuration files?"
|
||||||
@ -310,7 +321,14 @@ done
|
|||||||
|
|
||||||
if [ $key_bindings -eq 1 ] && [ $has_fish -eq 1 ]; then
|
if [ $key_bindings -eq 1 ] && [ $has_fish -eq 1 ]; then
|
||||||
bind_file=~/.config/fish/functions/fish_user_key_bindings.fish
|
bind_file=~/.config/fish/functions/fish_user_key_bindings.fish
|
||||||
append_line $update_config "fzf_key_bindings" "$bind_file"
|
if [ ! -e "$bind_file" ]; then
|
||||||
|
create_file "$bind_file" \
|
||||||
|
'function fish_user_key_bindings' \
|
||||||
|
' fzf_key_bindings' \
|
||||||
|
'end'
|
||||||
|
else
|
||||||
|
append_line $update_config "fzf_key_bindings" "$bind_file"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $update_config -eq 1 ]; then
|
if [ $update_config -eq 1 ]; then
|
||||||
|
Loading…
Reference in New Issue
Block a user