1
0
Fork 0

use default mappings when unset

This commit is contained in:
Andrey Listopadov 2021-03-21 13:33:27 +03:00
parent a8765bb03d
commit 3f2773c919
11 changed files with 40 additions and 40 deletions

View file

@ -222,9 +222,9 @@ fzf -params .. %{ evaluate-commands %sh{
( (
while read -r line; do while read -r line; do
case ${line} in case ${line} in
("${kak_opt_fzf_window_map:-}") wincmd="fzf-window" ;; ("${kak_opt_fzf_window_map:-ctrl-w}") wincmd="fzf-window" ;;
("${kak_opt_fzf_vertical_map:-}") wincmd="fzf-vertical" ;; ("${kak_opt_fzf_vertical_map:-ctrl-v}") wincmd="fzf-vertical" ;;
("${kak_opt_fzf_horizontal_map:-}") wincmd="fzf-horizontal" ;; ("${kak_opt_fzf_horizontal_map:-ctrl-s}") wincmd="fzf-horizontal" ;;
(*) item=${line} ;; (*) item=${line} ;;
esac esac
if [ -n "${item}" ]; then if [ -n "${item}" ]; then

View file

@ -24,8 +24,8 @@ define-command -hidden fzf-bzr %{ evaluate-commands %sh{
(bzr) cmd="(cd $repo_root && bzr ls -R --versioned)" ;; (bzr) cmd="(cd $repo_root && bzr ls -R --versioned)" ;;
(*) cmd=$kak_opt_fzf_bzr_command ;; (*) cmd=$kak_opt_fzf_bzr_command ;;
esac esac
[ -n "${kak_client_env_TMUX}" ] && additional_flags="--expect $kak_opt_fzf_vertical_map --expect $kak_opt_fzf_horizontal_map" [ -n "${kak_client_env_TMUX}" ] && additional_flags="--expect ${kak_opt_fzf_vertical_map:-ctrl-v} --expect ${kak_opt_fzf_horizontal_map:-ctrl-s}"
printf "%s\n" "fzf -kak-cmd %{edit -existing} -items-cmd %{$cmd} -fzf-args %{-m --expect $kak_opt_fzf_window_map $additional_flags} -filter %{perl -pe \"if (/$kak_opt_fzf_window_map|$kak_opt_fzf_vertical_map|$kak_opt_fzf_horizontal_map|^$/) {} else {print \\\"$repo_root/\\\"}\"}" printf "%s\n" "fzf -kak-cmd %{edit -existing} -items-cmd %{$cmd} -fzf-args %{-m --expect ${kak_opt_fzf_window_map:-ctrl-w} $additional_flags} -filter %{perl -pe \"if (/${kak_opt_fzf_window_map:-ctrl-w}|${kak_opt_fzf_vertical_map:-ctrl-v}|${kak_opt_fzf_horizontal_map:-ctrl-s}|^$/) {} else {print \\\"$repo_root/\\\"}\"}"
}} }}
§ §

View file

@ -24,8 +24,8 @@ define-command -hidden fzf-git %{ evaluate-commands %sh{
(git) cmd='git ls-tree --full-tree --name-only -r HEAD' ;; (git) cmd='git ls-tree --full-tree --name-only -r HEAD' ;;
(*) cmd=$kak_opt_fzf_git_command ;; (*) cmd=$kak_opt_fzf_git_command ;;
esac esac
[ ! -z "${kak_client_env_TMUX}" ] && additional_flags="--expect $kak_opt_fzf_vertical_map --expect $kak_opt_fzf_horizontal_map" [ ! -z "${kak_client_env_TMUX}" ] && additional_flags="--expect ${kak_opt_fzf_vertical_map:-ctrl-v} --expect ${kak_opt_fzf_horizontal_map:-ctrl-s}"
printf "%s\n" "fzf -kak-cmd %{edit -existing} -items-cmd %{$cmd} -fzf-args %{-m --expect $kak_opt_fzf_window_map $additional_flags} -filter %{perl -pe \"if (/$kak_opt_fzf_window_map|$kak_opt_fzf_vertical_map|$kak_opt_fzf_horizontal_map|^$/) {} else {print \\\"$(git rev-parse --show-toplevel)/\\\"}\"}" printf "%s\n" "fzf -kak-cmd %{edit -existing} -items-cmd %{$cmd} -fzf-args %{-m --expect ${kak_opt_fzf_window_map:-ctrl-w} $additional_flags} -filter %{perl -pe \"if (/${kak_opt_fzf_window_map:-ctrl-w}|${kak_opt_fzf_vertical_map:-ctrl-v}|${kak_opt_fzf_horizontal_map:-ctrl-s}|^$/) {} else {print \\\"$(git rev-parse --show-toplevel)/\\\"}\"}"
}} }}
§ §

View file

@ -24,8 +24,8 @@ define-command -hidden fzf-hg %{ evaluate-commands %sh{
(hg) cmd="hg locate -f" ;; (hg) cmd="hg locate -f" ;;
(hg*) cmd=$kak_opt_fzf_hg_command ;; (hg*) cmd=$kak_opt_fzf_hg_command ;;
esac esac
[ ! -z "${kak_client_env_TMUX}" ] && additional_flags="--expect $kak_opt_fzf_vertical_map --expect $kak_opt_fzf_horizontal_map" [ ! -z "${kak_client_env_TMUX}" ] && additional_flags="--expect ${kak_opt_fzf_vertical_map:-ctrl-v} --expect ${kak_opt_fzf_horizontal_map:-ctrl-s}"
printf "%s\n" "fzf -kak-cmd %{edit -existing} -items-cmd %{$cmd} -fzf-args %{-m --expect $kak_opt_fzf_window_map $additional_flags}" printf "%s\n" "fzf -kak-cmd %{edit -existing} -items-cmd %{$cmd} -fzf-args %{-m --expect ${kak_opt_fzf_window_map:-ctrl-w} $additional_flags}"
}} }}
§ §

View file

@ -25,8 +25,8 @@ define-command -hidden fzf-svn %{ evaluate-commands %sh{
(svn) cmd="svn list -R $repo_root | grep -v '$/'" ;; (svn) cmd="svn list -R $repo_root | grep -v '$/'" ;;
(svn*) cmd=$kak_opt_fzf_svn_command ;; (svn*) cmd=$kak_opt_fzf_svn_command ;;
esac esac
[ ! -z "${kak_client_env_TMUX}" ] && additional_flags="--expect $kak_opt_fzf_vertical_map --expect $kak_opt_fzf_horizontal_map" [ ! -z "${kak_client_env_TMUX}" ] && additional_flags="--expect ${kak_opt_fzf_vertical_map:-ctrl-v} --expect ${kak_opt_fzf_horizontal_map:-ctrl-s}"
printf "%s\n" "fzf -kak-cmd %{cd $repo_root; edit -existing} -items-cmd %{$cmd} -fzf-args %{-m --expect $kak_opt_fzf_window_map $additional_flags} -post-action %{cd $current_path}" printf "%s\n" "fzf -kak-cmd %{cd $repo_root; edit -existing} -items-cmd %{$cmd} -fzf-args %{-m --expect ${kak_opt_fzf_window_map:-ctrl-w} $additional_flags} -post-action %{cd $current_path}"
}} }}
§ §

View file

@ -20,14 +20,14 @@ $buffers"
message="Set buffer to edit in current client. message="Set buffer to edit in current client.
<ret>: switch to selected buffer. <ret>: switch to selected buffer.
${kak_opt_fzf_window_map:?}: open buffer in new window" ${kak_opt_fzf_window_map:-ctrl-w}: open buffer in new window"
[ -n "${kak_client_env_TMUX:-}" ] && tmux_keybindings=" [ -n "${kak_client_env_TMUX:-}" ] && tmux_keybindings="
${kak_opt_fzf_horizontal_map:-}: open buffer in horizontal split ${kak_opt_fzf_horizontal_map:-ctrl-s}: open buffer in horizontal split
${kak_opt_fzf_vertical_map:-}: open buffer in vertical split" ${kak_opt_fzf_vertical_map:-ctrl-v}: open buffer in vertical split"
printf "%s\n" "info -title 'fzf buffer' '$message$tmux_keybindings'" printf "%s\n" "info -title 'fzf buffer' '$message$tmux_keybindings'"
[ -n "${kak_client_env_TMUX:-}" ] && additional_flags="--expect $kak_opt_fzf_vertical_map --expect $kak_opt_fzf_horizontal_map" [ -n "${kak_client_env_TMUX:-}" ] && additional_flags="--expect ${kak_opt_fzf_vertical_map:-ctrl-v} --expect ${kak_opt_fzf_horizontal_map:-ctrl-s}"
printf "%s\n" "fzf -kak-cmd %{buffer} -items-cmd %{printf \"%s\n\" \"$buffers\"} -fzf-args %{--expect $kak_opt_fzf_window_map $additional_flags}" printf "%s\n" "fzf -kak-cmd %{buffer} -items-cmd %{printf \"%s\n\" \"$buffers\"} -fzf-args %{--expect ${kak_opt_fzf_window_map:-ctrl-w} $additional_flags}"
}} }}
define-command -hidden fzf-delete-buffer %{ evaluate-commands %sh{ define-command -hidden fzf-delete-buffer %{ evaluate-commands %sh{
@ -42,7 +42,7 @@ $buffers"
message="Delete buffer. message="Delete buffer.
<ret>: delete selected buffer." <ret>: delete selected buffer."
printf "%s\n" "info -title 'fzf delete-buffer' '$message'" printf "%s\n" "info -title 'fzf delete-buffer' '$message'"
printf "%s\n" "fzf -kak-cmd %{delete-buffer} -multiple-cmd %{delete-buffer} -items-cmd %{printf \"%s\n\" \"$buffers\"} -fzf-args %{-m --expect ${kak_opt_fzf_window_map:?} ${additional_flags:-}}" printf "%s\n" "fzf -kak-cmd %{delete-buffer} -multiple-cmd %{delete-buffer} -items-cmd %{printf \"%s\n\" \"$buffers\"} -fzf-args %{-m --expect ${kak_opt_fzf_window_map:-ctrl-w} ${additional_flags:-}}"
}} }}
§ §

View file

@ -928,17 +928,17 @@ define-command -hidden fzf-tag -params ..2 %{ evaluate-commands %sh{
message="Jump to a symbol''s definition message="Jump to a symbol''s definition
<ret>: open tag in new buffer <ret>: open tag in new buffer
${kak_opt_fzf_window_map:?}: open tag in new terminal" ${kak_opt_fzf_window_map:-ctrl-w}: open tag in new terminal"
[ -n "${kak_client_env_TMUX:?}" ] && tmux_keybindings=" [ -n "${kak_client_env_TMUX:?}" ] && tmux_keybindings="
${kak_opt_fzf_horizontal_map:-}: open tag in horizontal split ${kak_opt_fzf_horizontal_map:-ctrl-s}: open tag in horizontal split
${kak_opt_fzf_vertical_map:-}: open tag in vertical split" ${kak_opt_fzf_vertical_map:-ctrl-v}: open tag in vertical split"
printf "%s\n" "info -title 'fzf tag' '$message$tmux_keybindings'" printf "%s\n" "info -title 'fzf tag' '$message$tmux_keybindings'"
[ -n "${kak_client_env_TMUX}" ] && additional_flags="--expect $kak_opt_fzf_vertical_map --expect $kak_opt_fzf_horizontal_map" [ -n "${kak_client_env_TMUX}" ] && additional_flags="--expect ${kak_opt_fzf_vertical_map:-ctrl-v} --expect ${kak_opt_fzf_horizontal_map:-ctrl-s}"
printf "%s\n" "set-option -add window ctagsfiles %{$path/$kak_opt_fzf_tag_file_name}" printf "%s\n" "set-option -add window ctagsfiles %{$path/$kak_opt_fzf_tag_file_name}"
printf "%s\n" "fzf -kak-cmd %{ctags-search} -items-cmd %{$cmd | awk '!a[\$0]++'} -fzf-args %{--expect $kak_opt_fzf_window_map $additional_flags}" printf "%s\n" "fzf -kak-cmd %{ctags-search} -items-cmd %{$cmd | awk '!a[\$0]++'} -fzf-args %{--expect ${kak_opt_fzf_window_map:-ctrl-w} $additional_flags}"
}} }}
§ §

View file

@ -50,15 +50,15 @@ define-command -hidden fzf-file %{ evaluate-commands %sh{
cmd="$cmd 2>/dev/null" cmd="$cmd 2>/dev/null"
message="Open single or multiple files. message="Open single or multiple files.
<ret>: open file in new buffer. <ret>: open file in new buffer.
${kak_opt_fzf_window_map:?}: open file in new terminal" ${kak_opt_fzf_window_map:-ctrl-w}: open file in new terminal"
[ -n "${kak_client_env_TMUX:-}" ] && tmux_keybindings=" [ -n "${kak_client_env_TMUX:-}" ] && tmux_keybindings="
${kak_opt_fzf_horizontal_map:-}: open file in horizontal split ${kak_opt_fzf_horizontal_map:-ctrl-s}: open file in horizontal split
${kak_opt_fzf_vertical_map:-}: open file in vertical split" ${kak_opt_fzf_vertical_map:-ctrl-v}: open file in vertical split"
printf "%s\n" "info -title 'fzf file' '$message$tmux_keybindings'" printf "%s\n" "info -title 'fzf file' '$message$tmux_keybindings'"
[ -n "${kak_client_env_TMUX}" ] && additional_flags="--expect $kak_opt_fzf_vertical_map --expect $kak_opt_fzf_horizontal_map" [ -n "${kak_client_env_TMUX}" ] && additional_flags="--expect ${kak_opt_fzf_vertical_map:-ctrl-v} --expect ${kak_opt_fzf_horizontal_map:-ctrl-s}"
[ "${kak_opt_fzf_file_preview:-}" = "true" ] && preview_flag="-preview" [ "${kak_opt_fzf_file_preview:-}" = "true" ] && preview_flag="-preview"
printf "%s\n" "fzf $preview_flag -kak-cmd %{edit -existing} -items-cmd %{$cmd} -fzf-args %{-m --expect $kak_opt_fzf_window_map $additional_flags}" printf "%s\n" "fzf $preview_flag -kak-cmd %{edit -existing} -items-cmd %{$cmd} -fzf-args %{-m --expect ${kak_opt_fzf_window_map:-ctrl-w} $additional_flags}"
}} }}
§ §

View file

@ -35,14 +35,14 @@ define-command -hidden fzf-grep %{ evaluate-commands %sh{
title="fzf grep" title="fzf grep"
message="grep through contents of all files recursively. message="grep through contents of all files recursively.
<ret>: open search result in new buffer. <ret>: open search result in new buffer.
${kak_opt_fzf_window_map:?}: open search result in new terminal" ${kak_opt_fzf_window_map:-ctrl-w}: open search result in new terminal"
[ -n "${kak_client_env_TMUX:-}" ] && tmux_keybindings=" [ -n "${kak_client_env_TMUX:-}" ] && tmux_keybindings="
${kak_opt_fzf_horizontal_map:-}: open search result in horizontal split ${kak_opt_fzf_horizontal_map:-ctrl-s}: open search result in horizontal split
${kak_opt_fzf_vertical_map:-}: open search result in vertical split" ${kak_opt_fzf_vertical_map:-ctrl-v}: open search result in vertical split"
printf "%s\n" "info -title '${title}' '${message}${tmux_keybindings}'" printf "%s\n" "info -title '${title}' '${message}${tmux_keybindings}'"
[ -n "${kak_client_env_TMUX}" ] && additional_flags="--expect $kak_opt_fzf_vertical_map --expect $kak_opt_fzf_horizontal_map" [ -n "${kak_client_env_TMUX}" ] && additional_flags="--expect ${kak_opt_fzf_vertical_map:-ctrl-v} --expect ${kak_opt_fzf_horizontal_map:-ctrl-s}"
printf "%s\n" "fzf -kak-cmd %{evaluate-commands} -fzf-args %{--expect $kak_opt_fzf_window_map $additional_flags --delimiter=':' -n'3..'} -items-cmd %{$cmd} -filter %{sed -E 's/([^:]+):([^:]+):.*/edit -existing \1; execute-keys \2gvc/'}" printf "%s\n" "fzf -kak-cmd %{evaluate-commands} -fzf-args %{--expect ${kak_opt_fzf_window_map:-ctrl-w} $additional_flags --delimiter=':' -n'3..'} -items-cmd %{$cmd} -filter %{sed -E 's/([^:]+):([^:]+):.*/edit -existing \1; execute-keys \2gvc/'}"
}} }}
§ §

View file

@ -39,11 +39,11 @@ bzr status"
vcs=$(printf "%s\n" "$cmd" | awk '{print $1}') vcs=$(printf "%s\n" "$cmd" | awk '{print $1}')
title="fzf $vcs" title="fzf $vcs"
[ -n "${kak_client_env_TMUX:-}" ] && additional_keybindings=" [ -n "${kak_client_env_TMUX:-}" ] && additional_keybindings="
${kak_opt_fzf_horizontal_map:-}: open file in horizontal split ${kak_opt_fzf_horizontal_map:-ctrl-s}: open file in horizontal split
${kak_opt_fzf_vertical_map:-}: open file in vertical split" ${kak_opt_fzf_vertical_map:-ctrl-v}: open file in vertical split"
message="Open single or multiple files from git tree. message="Open single or multiple files from git tree.
<ret>: open file in new buffer. <ret>: open file in new buffer.
${kak_opt_fzf_window_map:?}: open file in new terminal $additional_keybindings" ${kak_opt_fzf_window_map:-ctrl-w}: open file in new terminal $additional_keybindings"
printf "%s\n" "info -title %{$title} %{$message}" printf "%s\n" "info -title %{$title} %{$message}"
printf "%s\n" "fzf-$vcs" printf "%s\n" "fzf-$vcs"
exit exit

View file

@ -29,14 +29,14 @@ define-command -hidden fzf-sk-grep %{ evaluate-commands %sh{
title="skim interactive grep" title="skim interactive grep"
message="Interactively grep pattern from current directory message="Interactively grep pattern from current directory
<ret>: open search result in new buffer. <ret>: open search result in new buffer.
${kak_opt_fzf_window_map:?}: open search result in new terminal" ${kak_opt_fzf_window_map:-ctrl-w}: open search result in new terminal"
[ -n "${kak_client_env_TMUX:-}" ] && tmux_keybindings=" [ -n "${kak_client_env_TMUX:-}" ] && tmux_keybindings="
${kak_opt_fzf_horizontal_map:-}: open search result in horizontal split ${kak_opt_fzf_horizontal_map:-ctrl-s}: open search result in horizontal split
${kak_opt_fzf_vertical_map:-}: open search result in vertical split" ${kak_opt_fzf_vertical_map:-ctrl-v}: open search result in vertical split"
printf "%s\n" "info -title '${title}' '${message}${tmux_keybindings}'" printf "%s\n" "info -title '${title}' '${message}${tmux_keybindings}'"
[ -n "${kak_client_env_TMUX}" ] && additional_flags="--expect $kak_opt_fzf_vertical_map --expect $kak_opt_fzf_horizontal_map" [ -n "${kak_client_env_TMUX}" ] && additional_flags="--expect ${kak_opt_fzf_vertical_map:-ctrl-v} --expect ${kak_opt_fzf_horizontal_map:-ctrl-s}"
printf "%s\n" "fzf -kak-cmd %{fzf-sk-grep-handler} -fzf-impl %{sk --ansi -m -i -c '${kak_opt_fzf_sk_grep_command:-} {}'} -fzf-args %{--expect $kak_opt_fzf_window_map $additional_flags} -multiple-cmd %{fzf-sk-populate-grep} -post-action %{buffer %opt{fzf_sk_first_file}}" printf "%s\n" "fzf -kak-cmd %{fzf-sk-grep-handler} -fzf-impl %{sk --ansi -m -i -c '${kak_opt_fzf_sk_grep_command:-} {}'} -fzf-args %{--expect ${kak_opt_fzf_window_map:-ctrl-w} $additional_flags} -multiple-cmd %{fzf-sk-populate-grep} -post-action %{buffer %opt{fzf_sk_first_file}}"
}} }}
define-command -hidden fzf-sk-grep-handler -params 1 %{ define-command -hidden fzf-sk-grep-handler -params 1 %{