From d2a9bdabfcd1542a9cbfe213f16ff065749848e5 Mon Sep 17 00:00:00 2001 From: Andrey Orst Date: Sun, 31 Mar 2019 09:47:36 +0300 Subject: [PATCH 1/2] use shebang instead of exporting shell --- rc/fzf.kak | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/rc/fzf.kak b/rc/fzf.kak index a7d67b8..af22658 100644 --- a/rc/fzf.kak +++ b/rc/fzf.kak @@ -168,10 +168,11 @@ fzf -params .. %{ evaluate-commands %sh{ fzfcmd="${fzf_tmp}/fzfcmd" result="${fzf_tmp}/result" - shell_executable="$(command -v sh)" - + # portable shebang + shell_path="$(command -v sh)" + [ -n "${shell_path}" ] && printf "%s\n" "#!${shell_path}" > ${fzfcmd} # compose entire fzf command with all args into single file which will be executed later - printf "%s\n" "cd \"${PWD}\" && ${preview_position} ${items_cmd} SHELL=${shell_executable} ${fzf_impl} ${fzf_args} ${preview_cmd} ${filter} > ${result}; rm ${fzfcmd}" > ${fzfcmd} + printf "%s\n" "cd \"${PWD}\" && ${preview_position} ${items_cmd} ${fzf_impl} ${fzf_args} ${preview_cmd} ${filter} > ${result}; rm ${fzfcmd}" >> ${fzfcmd} chmod 755 ${fzfcmd} From 4b1f1fcdf9f5c1a5700fc9d3b91295a67c9090cc Mon Sep 17 00:00:00 2001 From: Andrey Orst Date: Sun, 31 Mar 2019 12:57:39 +0300 Subject: [PATCH 2/2] set SHELL --- rc/fzf.kak | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/rc/fzf.kak b/rc/fzf.kak index af22658..9564012 100644 --- a/rc/fzf.kak +++ b/rc/fzf.kak @@ -168,12 +168,18 @@ fzf -params .. %{ evaluate-commands %sh{ fzfcmd="${fzf_tmp}/fzfcmd" result="${fzf_tmp}/result" - # portable shebang - shell_path="$(command -v sh)" - [ -n "${shell_path}" ] && printf "%s\n" "#!${shell_path}" > ${fzfcmd} - # 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}; rm ${fzfcmd}" >> ${fzfcmd} - + ( + shell_path="$(command -v sh)" + if [ -n "${shell_path}" ]; then + # portable shebang + printf "%s\n" "#!${shell_path}" + # set SHELL because fzf preview uses it + 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" "rm ${fzfcmd}" + ) >> ${fzfcmd} chmod 755 ${fzfcmd} if [ -n "${kak_client_env_TMUX}" ]; then