add fzf-delete-buffer
This commit is contained in:
parent
ed81b70619
commit
0319d8769c
1 changed files with 20 additions and 3 deletions
|
@ -11,12 +11,14 @@
|
||||||
hook global ModuleLoaded fzf %§
|
hook global ModuleLoaded fzf %§
|
||||||
|
|
||||||
map global fzf -docstring "open buffer" 'b' '<esc>: fzf-buffer<ret>'
|
map global fzf -docstring "open buffer" 'b' '<esc>: fzf-buffer<ret>'
|
||||||
|
map global fzf -docstring "open buffer" '<a-b>' '<esc>: fzf-delete-buffer<ret>'
|
||||||
|
|
||||||
define-command -hidden fzf-buffer %{ evaluate-commands %sh{
|
define-command -hidden fzf-buffer %{ evaluate-commands %sh{
|
||||||
buffers=$(mktemp ${TMPDIR:-/tmp}/kak-fzf-buffers.XXXXXX)
|
buffers=""
|
||||||
eval "set -- $kak_quoted_buflist"
|
eval "set -- $kak_quoted_buflist"
|
||||||
while [ $# -gt 0 ]; do
|
while [ $# -gt 0 ]; do
|
||||||
printf "%s\n" "$1" >> $buffers
|
buffers="$1
|
||||||
|
$buffers"
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@ -29,7 +31,22 @@ $kak_opt_fzf_vertical_map: 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'"
|
||||||
[ ! -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 --expect $kak_opt_fzf_horizontal_map"
|
||||||
|
|
||||||
printf "%s\n" "fzf -kak-cmd %{buffer} -items-cmd %{(cat $buffers; rm $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 $additional_flags}"
|
||||||
|
}}
|
||||||
|
|
||||||
|
define-command -hidden fzf-delete-buffer %{ evaluate-commands %sh{
|
||||||
|
buffers=""
|
||||||
|
eval "set -- $kak_quoted_buflist"
|
||||||
|
while [ $# -gt 0 ]; do
|
||||||
|
buffers="$1
|
||||||
|
$buffers"
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
|
||||||
|
message="Delete buffer.
|
||||||
|
<ret>: delete selected buffer."
|
||||||
|
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}"
|
||||||
}}
|
}}
|
||||||
|
|
||||||
§
|
§
|
||||||
|
|
Loading…
Reference in a new issue