diff --git a/rc/fzf.kak b/rc/fzf.kak index fe5730c..6ec0229 100644 --- a/rc/fzf.kak +++ b/rc/fzf.kak @@ -137,6 +137,10 @@ Switches: fzf -params .. %{ evaluate-commands %sh{ fzf_impl="${kak_opt_fzf_implementation}" + if [ $(printf "%s" "${kak_selection}" | wc -m) -gt 1 ]; then + default_query="-i -q ${kak_selection}" + fi + while [ $# -gt 0 ]; do case $1 in (-kak-cmd) shift; kakoune_cmd="$1" ;; @@ -191,7 +195,7 @@ fzf -params .. %{ evaluate-commands %sh{ printf "%s\n" "SHELL=${shell_path}" fi # compose entire fzf command with all args into single file which will be executed later - printf "%s\n" "cd \"${PWD}\" && ${preview_position} ${items_cmd} ${fzf_impl} ${fzf_args} ${preview_cmd} ${filter} > ${result}" + printf "%s\n" "cd \"${PWD}\" && ${preview_position} ${items_cmd} ${fzf_impl} ${default_query} ${fzf_args} ${preview_cmd} ${filter} > ${result}" printf "%s\n" "rm ${fzfcmd}" ) >> ${fzfcmd} chmod 755 ${fzfcmd}