diff options
Diffstat (limited to 'install')
-rwxr-xr-x | install | 34 |
1 files changed, 20 insertions, 14 deletions
@@ -262,6 +262,12 @@ if [[ ! "\$PATH" == *$fzf_base_esc/bin* ]]; then PATH="\${PATH:+\${PATH}:}$fzf_base/bin" fi +EOF + + if [[ $auto_completion -eq 1 ]] && [[ $key_bindings -eq 1 ]]; then + echo "eval \"\$(fzf --$shell)\"" >> "$src" + else + cat >> "$src" << EOF # Auto-completion # --------------- $fzf_completion @@ -270,6 +276,7 @@ $fzf_completion # ------------ $fzf_key_bindings EOF + fi echo "OK" done @@ -281,18 +288,6 @@ if [[ "$shells" =~ fish ]]; then or set --universal fish_user_paths \$fish_user_paths "$fzf_base"/bin EOF [ $? -eq 0 ] && echo "OK" || echo "Failed" - - mkdir -p "${fish_dir}/functions" - fish_binding="${fish_dir}/functions/fzf_key_bindings.fish" - if [ $key_bindings -ne 0 ]; then - echo -n "Symlink $fish_binding ... " - ln -sf "$fzf_base/shell/key-bindings.fish" \ - "$fish_binding" && echo "OK" || echo "Failed" - else - echo -n "Removing $fish_binding ... " - rm -f "$fish_binding" - echo "OK" - fi fi append_line() { @@ -355,12 +350,23 @@ done if [ $key_bindings -eq 1 ] && [[ "$shells" =~ fish ]]; then bind_file="${fish_dir}/functions/fish_user_key_bindings.fish" if [ ! -e "$bind_file" ]; then + mkdir -p "${fish_dir}/functions" create_file "$bind_file" \ 'function fish_user_key_bindings' \ - ' fzf_key_bindings' \ + ' fzf --fish | source' \ 'end' else - append_line $update_config "fzf_key_bindings" "$bind_file" + echo "Check $bind_file:" + lno=$(\grep -nF "fzf_key_bindings" "$bind_file" | sed 's/:.*//' | tr '\n' ' ') + if [[ -n $lno ]]; then + echo " ** Found 'fzf_key_bindings' in line #$lno" + echo " ** You have to replace the line to 'fzf --fish | source'" + echo + else + echo " - Clear" + echo + append_line $update_config "fzf --fish | source" "$bind_file" + fi fi fi |