diff --git a/rc/fzf-modules/VCS/fzf-bzr.kak b/rc/fzf-modules/VCS/fzf-bzr.kak index 1f6bb1a..ecdee58 100644 --- a/rc/fzf-modules/VCS/fzf-bzr.kak +++ b/rc/fzf-modules/VCS/fzf-bzr.kak @@ -27,6 +27,6 @@ define-command -hidden fzf-bzr %{ evaluate-commands %sh{ cmd=$kak_opt_fzf_bzr_command ;; esac [ ! -z "${kak_client_env_TMUX}" ] && additional_flags="--expect ctrl-v --expect ctrl-s" - echo "fzf %{edit \$1} %{$cmd} %{-m --expect ctrl-w $additional_flags}" + echo "fzf %{edit} %{$cmd} %{-m --expect ctrl-w $additional_flags}" }} diff --git a/rc/fzf-modules/VCS/fzf-git.kak b/rc/fzf-modules/VCS/fzf-git.kak index 4e98a84..dada37a 100644 --- a/rc/fzf-modules/VCS/fzf-git.kak +++ b/rc/fzf-modules/VCS/fzf-git.kak @@ -27,6 +27,6 @@ define-command -hidden fzf-git %{ evaluate-commands %sh{ cmd=$kak_opt_fzf_git_command ;; esac [ ! -z "${kak_client_env_TMUX}" ] && additional_flags="--expect ctrl-v --expect ctrl-s" - echo "fzf %{edit \$1} %{$cmd} %{-m --expect ctrl-w $additional_flags}" + echo "fzf %{edit} %{$cmd} %{-m --expect ctrl-w $additional_flags}" }} diff --git a/rc/fzf-modules/VCS/fzf-hg.kak b/rc/fzf-modules/VCS/fzf-hg.kak index 94a2e0c..6a49de1 100644 --- a/rc/fzf-modules/VCS/fzf-hg.kak +++ b/rc/fzf-modules/VCS/fzf-hg.kak @@ -27,6 +27,6 @@ define-command -hidden fzf-hg %{ evaluate-commands %sh{ cmd=$kak_opt_fzf_hg_command ;; esac [ ! -z "${kak_client_env_TMUX}" ] && additional_flags="--expect ctrl-v --expect ctrl-s" - echo "fzf %{edit \$1} %{$cmd} %{-m --expect ctrl-w $additional_flags}" + echo "fzf %{edit} %{$cmd} %{-m --expect ctrl-w $additional_flags}" }} diff --git a/rc/fzf-modules/VCS/fzf-svn.kak b/rc/fzf-modules/VCS/fzf-svn.kak index 4e3004d..0a439de 100644 --- a/rc/fzf-modules/VCS/fzf-svn.kak +++ b/rc/fzf-modules/VCS/fzf-svn.kak @@ -27,6 +27,6 @@ define-command -hidden fzf-svn %{ evaluate-commands %sh{ cmd=$kak_opt_fzf_svn_command ;; esac [ ! -z "${kak_client_env_TMUX}" ] && additional_flags="--expect ctrl-v --expect ctrl-s" - echo "fzf %{edit \$1} %{$cmd} %{-m --expect ctrl-w $additional_flags}" + echo "fzf %{edit} %{$cmd} %{-m --expect ctrl-w $additional_flags}" }} diff --git a/rc/fzf-modules/fzf-cd.kak b/rc/fzf-modules/fzf-cd.kak index dfd7cdb..f73a06e 100644 --- a/rc/fzf-modules/fzf-cd.kak +++ b/rc/fzf-modules/fzf-cd.kak @@ -26,6 +26,6 @@ define-command -hidden fzf-cd %{ evaluate-commands %sh{ *) cmd=$kak_opt_fzf_cd_command ;; esac - echo "fzf %{change-directory \$1} %{$cmd}" + echo "fzf %{change-directory} %{$cmd}" }} diff --git a/rc/fzf-modules/fzf-ctags.kak b/rc/fzf-modules/fzf-ctags.kak index 4da1c7d..1b72470 100644 --- a/rc/fzf-modules/fzf-ctags.kak +++ b/rc/fzf-modules/fzf-ctags.kak @@ -885,7 +885,7 @@ declare-option -hidden -docstring "A set of mappings for AnsiblePlaybook filetyp str fzf_tag_ansibleplaybook " : plays" -define-command -hidden fzf-tag -params ..1 %{ evaluate-commands %sh{ +define-command -hidden fzf-tag -params ..2 %{ evaluate-commands %sh{ case $kak_opt_filetype in ada) additional_keybindings="--expect ctrl-alt-p --expect alt-p --expect ctrl-alt-t --expect alt-t --expect ctrl-alt-u --expect alt-u --expect alt-c --expect alt-l --expect ctrl-alt-v --expect alt-v --expect alt-f --expect alt-n --expect alt-x --expect ctrl-alt-r --expect alt-r --expect ctrl-alt-k --expect alt-k --expect ctrl-alt-o --expect alt-o --expect ctrl-alt-e --expect alt-e --expect alt-b --expect alt-i --expect alt-a --expect alt-y --expect ctrl-alt-s" @@ -1234,5 +1234,5 @@ Additional filters for $kak_opt_filetype filetype: $additional_message" [ ! -z "${kak_client_env_TMUX}" ] && additional_flags="--expect ctrl-v --expect ctrl-s" echo "set-option window ctagsfiles %{$path/${kak_opt_tagfile:-tags}}" - echo "fzf %{ctags-search \$1} %{$cmd | awk '!a[\$0]++'} %{--expect ctrl-w $additional_flags $additional_keybindings}" + echo "fzf %{ctags-search} %{$cmd | awk '!a[\$0]++'} %{--expect ctrl-w $additional_flags $additional_keybindings}" }} diff --git a/rc/fzf-modules/fzf-file.kak b/rc/fzf-modules/fzf-file.kak index 3b36685..748e047 100644 --- a/rc/fzf-modules/fzf-file.kak +++ b/rc/fzf-modules/fzf-file.kak @@ -27,7 +27,7 @@ str fzf_file_command "find" map global fzf -docstring "open file" 'f' ': fzf-file' define-command -hidden fzf-file %{ evaluate-commands %sh{ - if [ -z $(command -v $kak_opt_fzf_file_command) ]; then + if [ -z "$(command -v $kak_opt_fzf_file_command)" ]; then echo "echo -markup '{Information}''$kak_opt_fzf_file_command'' is not installed. Falling back to ''find'''" kak_opt_fzf_file_command="find" fi @@ -56,6 +56,6 @@ define-command -hidden fzf-file %{ evaluate-commands %sh{ : open file in new window $additional_keybindings" echo "info -title '$title' '$message'" [ ! -z "${kak_client_env_TMUX}" ] && additional_flags="--expect ctrl-v --expect ctrl-s" - echo "fzf %{edit \$1} %{$cmd} %{-m --expect ctrl-w $additional_flags}" + echo "fzf %{edit} %{$cmd} %{-m --expect ctrl-w $additional_flags}" }} diff --git a/rc/fzf-modules/fzf-search.kak b/rc/fzf-modules/fzf-search.kak index 5a07f2f..bf8e5cb 100644 --- a/rc/fzf-modules/fzf-search.kak +++ b/rc/fzf-modules/fzf-search.kak @@ -19,6 +19,6 @@ define-command -hidden fzf-buffer-search %{ evaluate-commands %sh{ buffer_content=$(mktemp ${TMPDIR:-/tmp}/kak-curr-buff.XXXXXX) echo "execute-keys %{%cat>$buffer_content;}" echo "execute-keys $line g $char l" - echo "fzf %{execute-keys \$1 gx} %{(nl -b a -n ln $buffer_content} %{--reverse | cut -f 1; rm $buffer_content)}" + echo "fzf %{execute-keys} %{(nl -b a -n ln $buffer_content} %{--reverse | cut -f 1; rm $buffer_content; echo 'gx')}" }} diff --git a/rc/fzf.kak b/rc/fzf.kak index aadae19..ff85cfa 100644 --- a/rc/fzf.kak +++ b/rc/fzf.kak @@ -55,7 +55,6 @@ declare-option -docstring "height of preview window. Default value: 60%%" \ str fzf_preview_height '60%' -# Commands define-command -docstring "Enter fzf-mode. fzf-mode contains mnemonic key bindings for every fzf.kak command @@ -77,7 +76,6 @@ define-command -hidden fzf -params 2..3 %{ evaluate-commands %sh{ fi tmp=$(mktemp $(eval echo ${TMPDIR:-/tmp}/kak-fzf.XXXXXX)) - exec=$(mktemp $(eval echo ${TMPDIR:-/tmp}/kak-exec.XXXXXX)) if [ "$(echo $callback | grep -o -E '[[:alpha:]]+' | head -1)" = "edit" ] && [ $kak_opt_fzf_preview = "true" ]; then case $kak_opt_fzf_highlighter in @@ -138,19 +136,22 @@ define-command -hidden fzf -params 2..3 %{ evaluate-commands %sh{ wincmd= ;; esac callback="$wincmd$callback" - echo "echo evaluate-commands -client $kak_client \"$callback\" | kak -p $kak_session" > $exec + kakoune_command () { + echo "evaluate-commands -client $kak_client '$callback' '$1'" + } else - echo "echo evaluate-commands -client $kak_client \"$callback\" | kak -p $kak_session" > $exec - echo "echo evaluate-commands -client $kak_client \"fzf-cd\" | kak -p $kak_session" >> $exec + kakoune_command() { + echo "evaluate-commands -client $kak_client '$callback' '$1'" + echo "evaluate-commands -client $kak_client fzf-cd" + } fi - chmod 755 $exec - while read file; do - $exec "\'$file'" + while read item; do + kakoune_command "$item" | kak -p $kak_session done ) < $tmp fi rm $tmp - rm $exec + rm $kakoune_command [ -z "$fzfcmd" ] && rm $fzfcmd ) > /dev/null 2>&1 < /dev/null & }}