1
0
Fork 0
This commit is contained in:
Andrey Listopadov 2021-04-03 13:02:39 +03:00
parent 3f2773c919
commit bfe1bc0a3d

View file

@ -138,10 +138,13 @@ Switches:
fzf -params .. %{ evaluate-commands %sh{ fzf -params .. %{ evaluate-commands %sh{
fzf_impl="${kak_opt_fzf_implementation:?}" fzf_impl="${kak_opt_fzf_implementation:?}"
# trims selection and escapes single quotes
selection=$(printf "%s" "${kak_selection:-}" | sed -e "s/^[[:blank:]]*//g;s/[[:blank:]]*$//g;s/'/'\\\\''/g")
[ "${kak_opt_fzf_use_main_selection:-}" = "true" ] && \ [ "${kak_opt_fzf_use_main_selection:-}" = "true" ] && \
[ "$(printf "%s" "${kak_selection:-}" | wc -m)" -gt 1 ] && \ [ "$(printf "%s" "$kak_selection" | wc -m)" -gt 1 ] && \
[ "$(printf "%s" "${kak_selection:-}" | wc -l)" -eq 1 ] && \ [ "$(printf "%s\n" "$selection" | wc -l)" -eq 1 ] && \
default_query="-i -q ${kak_selection:-}" default_query="-i -q '$selection'"
while [ $# -gt 0 ]; do while [ $# -gt 0 ]; do
case $1 in case $1 in