1
0
Fork 0

use selection as default search query

This commit is contained in:
Andrey Orst 2020-03-13 19:01:19 +03:00
parent e862cb5b78
commit dc6d0a504e

View file

@ -137,6 +137,10 @@ Switches:
fzf -params .. %{ evaluate-commands %sh{ fzf -params .. %{ evaluate-commands %sh{
fzf_impl="${kak_opt_fzf_implementation}" 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 while [ $# -gt 0 ]; do
case $1 in case $1 in
(-kak-cmd) shift; kakoune_cmd="$1" ;; (-kak-cmd) shift; kakoune_cmd="$1" ;;
@ -191,7 +195,7 @@ fzf -params .. %{ evaluate-commands %sh{
printf "%s\n" "SHELL=${shell_path}" printf "%s\n" "SHELL=${shell_path}"
fi fi
# compose entire fzf command with all args into single file which will be executed later # 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}" printf "%s\n" "rm ${fzfcmd}"
) >> ${fzfcmd} ) >> ${fzfcmd}
chmod 755 ${fzfcmd} chmod 755 ${fzfcmd}