diff --git a/rc/fzf-modules/fzf-buffer.kak b/rc/fzf-modules/fzf-buffer.kak index bf431ed..f9636fb 100644 --- a/rc/fzf-modules/fzf-buffer.kak +++ b/rc/fzf-modules/fzf-buffer.kak @@ -12,6 +12,11 @@ map global fzf -docstring "open buffer" 'b' ': fzf-buffer' define-command -hidden fzf-buffer %{ evaluate-commands %sh{ printf "%s\n" "info -title %{fzf buffer} %{Set buffer to edit in current client.}" - buffers=$(printf "%s\n" "$kak_buflist" | sed "s/^'//;s/'$/\n/;s/' '/\n/g") - printf "%s\n" "fzf %{buffer} %{printf \"%s\n\" \"$buffers\"}" + buffers=$(mktemp ${TMPDIR:-/tmp}/kak-fzf-buffers.XXXXXX) + eval "set -- $kak_buflist" + while [ $# -gt 0 ]; do + printf "%s\n" "$1" >> $buffers + shift + done + printf "%s\n" "fzf %{buffer} %{(cat $buffers; rm $buffers)}" }}