diff options
author | Junegunn Choi <junegunn.c@gmail.com> | 2017-04-28 01:57:38 +0900 |
---|---|---|
committer | Junegunn Choi <junegunn.c@gmail.com> | 2017-04-28 01:57:38 +0900 |
commit | 5677e5e1338a07d00d0a1c74ce918710a9ce8fdc (patch) | |
tree | 63807f2476bcb38392341e3a311c6d475425fa51 /install | |
parent | 7a11a06cbd03353e7c0c7ddc25cd6e9fe58cef6d (diff) |
[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
Diffstat (limited to 'install')
-rwxr-xr-x | install | 20 |
1 files changed, 19 insertions, 1 deletions
@@ -297,6 +297,17 @@ append_line() { 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 echo 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 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 if [ $update_config -eq 1 ]; then |