1
0
Fork 0

little more doc

This commit is contained in:
Andrey Orst 2019-03-27 20:23:33 +03:00
parent 088ff3805f
commit 9968488ba8

View file

@ -121,6 +121,8 @@ Switches:
-post-action" -post-action"
} \ } \
fzf -params .. %{ evaluate-commands %sh{ fzf -params .. %{ evaluate-commands %sh{
fzf_impl="${kak_opt_fzf_implementation}"
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" ;;
@ -131,14 +133,9 @@ fzf -params .. %{ evaluate-commands %sh{
-preview) preview="true" ;; -preview) preview="true" ;;
-filter) shift; filter="| $1" ;; -filter) shift; filter="| $1" ;;
-post-action) shift; post_action="$1" ;; -post-action) shift; post_action="$1" ;;
esac esac; shift
shift
done done
if [ -z "${fzf_impl}" ]; then
fzf_impl="${kak_opt_fzf_implementation}"
fi
if [ "${preview}" = "true" ]; then if [ "${preview}" = "true" ]; then
# bake position option to define them at runtime # bake position option to define them at runtime
if [ -n "${kak_client_env_TMUX}" ]; then if [ -n "${kak_client_env_TMUX}" ]; then
@ -146,6 +143,7 @@ fzf -params .. %{ evaluate-commands %sh{
# tmux height should be changed when preview is on # tmux height should be changed when preview is on
tmux_height="${kak_opt_fzf_preview_tmux_height}" tmux_height="${kak_opt_fzf_preview_tmux_height}"
else else
# this code chooses previewposition depending on window width at runtime
preview_position="sleep 0.1; [ \$(tput cols) -gt \$(expr \$(tput lines) \* 2) ] && pos=right:${kak_opt_fzf_preview_width} || pos=top:${kak_opt_fzf_preview_height};" preview_position="sleep 0.1; [ \$(tput cols) -gt \$(expr \$(tput lines) \* 2) ] && pos=right:${kak_opt_fzf_preview_width} || pos=top:${kak_opt_fzf_preview_height};"
fi fi
# handle preview if not defined explicitly with `-preview-cmd' # handle preview if not defined explicitly with `-preview-cmd'
@ -169,6 +167,7 @@ fzf -params .. %{ evaluate-commands %sh{
# 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} SHELL=${shell_executable} ${fzf_impl} ${fzf_args} ${preview_cmd} ${filter} > ${result}; rm ${fzfcmd}" > ${fzfcmd} printf "%s\n" "cd \"${PWD}\" && ${preview_position} ${items_cmd} SHELL=${shell_executable} ${fzf_impl} ${fzf_args} ${preview_cmd} ${filter} > ${result}; rm ${fzfcmd}" > ${fzfcmd}
chmod 755 ${fzfcmd} chmod 755 ${fzfcmd}
if [ -n "${kak_client_env_TMUX}" ]; then if [ -n "${kak_client_env_TMUX}" ]; then
@ -184,9 +183,7 @@ fzf -params .. %{ evaluate-commands %sh{
printf "%s\n" "${cmd}" printf "%s\n" "${cmd}"
( while [ -e ${fzfcmd} ]; do ( while [ -e ${fzfcmd} ]; do sleep 0.1 done
sleep 0.1
done
if [ -s ${result} ]; then if [ -s ${result} ]; then
( (
while read line; do while read line; do