From ec107f4c498d8149c48f07f6b0724038e029d6d6 Mon Sep 17 00:00:00 2001 From: Andrey Orst Date: Tue, 27 Nov 2018 09:06:10 +0300 Subject: [PATCH] fix #27 --- rc/fzf-modules/fzf-buffer.kak | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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)}" }}