1
0
Fork 0

use 'command' instead of 'cmd' #63

This commit is contained in:
Andrey Orst 2019-07-17 08:53:36 +03:00
parent 7fef4973e6
commit c5d8ca65a1
3 changed files with 10 additions and 10 deletions

View file

@ -118,7 +118,7 @@ configurations below.
### Windowing
If you're using Tmux, you do not have to worry about windowing, since fzf.kak
automatically creates all needed Tmux splits and panes for you. However in case
you're not using Tmux, fzf.kak uses `fzf_terminal_cmd` option to call windowing
you're not using Tmux, fzf.kak uses `fzf_terminal_command` option to call windowing
command to create new windows. By default it is set to use `terminal` alias:
`terminal kak -c %val{session} -e "%arg{@}"`, but some terminals can provide
other aliases or commands, like `terminal-tab` in Kitty. You may want to edit
@ -180,7 +180,7 @@ option to `false`.
#### Highlighting preview window
You also can highlight contents of the file displayed within preview window. To
do so, you can specify which highlighter to use with `fzf_highlight_cmd` option.
do so, you can specify which highlighter to use with `fzf_highlight_command` option.
Supported highlighters are:
* [Bat][16]

View file

@ -57,7 +57,7 @@ These are default arguments for the tools above:
highlight: "highlight --failsafe -O ansi {}"
rouge: "rougify {}"
' \
str fzf_highlight_cmd "highlight"
str fzf_highlight_command "highlight"
declare-option -docstring "height of fzf tmux split in screen lines or percents.
Default value: 25%%" \
@ -87,7 +87,7 @@ str fzf_horizontal_map 'ctrl-s'
declare-option -docstring 'command to use to create new window when not using tmux.
Default value: terminal kak -c %val{session} -e "%arg{@}"' \
str fzf_terminal_cmd 'terminal kak -c %val{session} -e "%arg{@}"'
str fzf_terminal_command 'terminal kak -c %val{session} -e "%arg{@}"'
try %{ declare-user-mode fzf }
@ -106,7 +106,7 @@ fzf-window -params .. %{ evaluate-commands %sh{
if [ -n "$kak_client_env_TMUX" ]; then
printf "%s\n" 'tmux-terminal-window kak -c %val{session} -e "%arg{@}"'
else
printf "%s\n" "$kak_opt_fzf_terminal_cmd"
printf "%s\n" "$kak_opt_fzf_terminal_command"
fi
}}
@ -167,12 +167,12 @@ fzf -params .. %{ evaluate-commands %sh{
# handle preview if not defined explicitly with `-preview-cmd'
if [ ${kak_opt_fzf_preview} = "true" ] && [ -z "${preview_cmd}" ]; then
case ${kak_opt_fzf_highlight_cmd} in
case ${kak_opt_fzf_highlight_command} in
(bat) highlight_cmd="bat --color=always --style=plain {}" ;;
(coderay) highlight_cmd="coderay {}" ;;
(highlight) highlight_cmd="highlight --failsafe -O ansi {}" ;;
(rouge) highlight_cmd="rougify {}" ;;
(*) highlight_cmd="${kak_opt_fzf_highlight_cmd}" ;;
(*) highlight_cmd="${kak_opt_fzf_highlight_command}" ;;
esac
preview_cmd="--preview '(${highlight_cmd} || cat {}) 2>/dev/null | head -n ${kak_opt_fzf_preview_lines}' --preview-window=\${pos}"
fi
@ -204,7 +204,7 @@ fzf -params .. %{ evaluate-commands %sh{
# `terminal' doesn't support any kind of width and height parameters, so tmux panes are created by tmux itself
cmd="nop %sh{ command tmux split-window ${measure} ${tmux_height%%%*} '${fzfcmd}' }"
else
cmd="${kak_opt_fzf_terminal_cmd%% *} %{${fzfcmd}}"
cmd="${kak_opt_fzf_terminal_command%% *} %{${fzfcmd}}"
fi
printf "%s\n" "${cmd}"

View file

@ -24,7 +24,7 @@ declare-option -docstring 'command to show list of directories in preview window
Default value:
tree -d
' \
str cd_preview_cmd "tree -d {}"
str cd_preview_command "tree -d {}"
declare-option -docstring 'maximum amount of previewed directories' \
int fzf_preview_dirs '300'
@ -43,7 +43,7 @@ current path: $(pwd)}"
esac
if [ "$kak_opt_fzf_cd_preview" = "true" ]; then
preview_flag="-preview"
preview="--preview '($kak_opt_cd_preview_cmd) 2>/dev/null | head -n $kak_opt_fzf_preview_dirs'"
preview="--preview '($kak_opt_cd_preview_command) 2>/dev/null | head -n $kak_opt_fzf_preview_dirs'"
fi
printf "%s\n" "fzf $preview_flag -kak-cmd %{change-directory} -items-cmd %{$items_command} -preview-cmd %{$preview} -post-action %{fzf-cd}"
}}