1
0
Fork 0

fix some placings of files, and other minor things

This commit is contained in:
Andrey Orst 2018-11-23 15:17:29 +03:00
parent e667e12844
commit e098ff81c9

View file

@ -67,16 +67,14 @@ define-command -hidden fzf -params 2..3 %{ evaluate-commands %sh{
callback=$1 callback=$1
items_command=$2 items_command=$2
additional_flags=$3 additional_flags=$3
tmux_height=$kak_opt_fzf_tmux_height
items_executable=$(printf "%s\n" "$items_command" | grep -o -E "[[:alpha:]]+" | head -1) items_executable=$(printf "%s\n" "$items_command" | grep -o -E "[[:alpha:]]+" | head -1)
if [ -z $(command -v $items_executable) ]; then if [ -z "$(command -v $items_executable)" ]; then
printf "%s\n" "fail %{'$items_executable' executable not found}" printf "%s\n" "fail %{'$items_executable' executable not found}"
exit exit
fi fi
tmp=$(mktemp ${TMPDIR:-/tmp}/kak-fzf.XXXXXX)
tmux_height=$kak_opt_fzf_tmux_height
if [ "$callback" = "edit" ] && [ $kak_opt_fzf_preview = "true" ]; then if [ "$callback" = "edit" ] && [ $kak_opt_fzf_preview = "true" ]; then
case $kak_opt_fzf_highlighter in case $kak_opt_fzf_highlighter in
bat) bat)
@ -105,6 +103,7 @@ define-command -hidden fzf -params 2..3 %{ evaluate-commands %sh{
additional_flags="--preview '($highlighter || cat {}) 2>/dev/null | head -n $kak_opt_fzf_preview_lines' --preview-window=\$pos $additional_flags" additional_flags="--preview '($highlighter || cat {}) 2>/dev/null | head -n $kak_opt_fzf_preview_lines' --preview-window=\$pos $additional_flags"
fi fi
tmp=$(mktemp ${TMPDIR:-/tmp}/kak-fzf.XXXXXX)
shell=$(command -v sh) shell=$(command -v sh)
if [ ! -z "${kak_client_env_TMUX}" ]; then if [ ! -z "${kak_client_env_TMUX}" ]; then
cmd="export SHELL=$shell; $preview_pos $items_command | fzf-tmux -d $tmux_height $additional_flags > $tmp" cmd="export SHELL=$shell; $preview_pos $items_command | fzf-tmux -d $tmux_height $additional_flags > $tmp"
@ -131,10 +130,7 @@ define-command -hidden fzf -params 2..3 %{ evaluate-commands %sh{
ctrl-v) ctrl-v)
wincmd="tmux-new-horizontal" ;; wincmd="tmux-new-horizontal" ;;
*) *)
if [ -n "$action" ]; then [ -n "$action" ] && printf "%s\n" "evaluate-commands -client $kak_client '$callback' '$action'" | kak -p $kak_session ;;
printf "%s\n" "evaluate-commands -client $kak_client '$callback' '$action'" | kak -p $kak_session
fi
;;
esac esac
kakoune_command() { kakoune_command() {
printf "%s\n" "evaluate-commands -client $kak_client '$wincmd $callback' '$1'" printf "%s\n" "evaluate-commands -client $kak_client '$wincmd $callback' '$1'"
@ -145,7 +141,7 @@ define-command -hidden fzf -params 2..3 %{ evaluate-commands %sh{
) < $tmp ) < $tmp
fi fi
rm $tmp rm $tmp
[ -z "$fzfcmd" ] && rm $fzfcmd [ -n "$fzfcmd" ] && rm $fzfcmd
) > /dev/null 2>&1 < /dev/null & ) > /dev/null 2>&1 < /dev/null &
}} }}