From e15203213cc57a4c1b699de4a9455f3fa396d08b Mon Sep 17 00:00:00 2001 From: Ferran Pelayo Monfort Date: Wed, 28 Mar 2018 23:14:18 +0200 Subject: [PATCH] [vim] Respect switchbuf option --- plugin/fzf.vim | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugin/fzf.vim b/plugin/fzf.vim index 7c313787..53bd8a32 100644 --- a/plugin/fzf.vim +++ b/plugin/fzf.vim @@ -205,10 +205,6 @@ function! s:common_sink(action, lines) abort return endif let key = remove(a:lines, 0) - let Cmd = get(a:action, key, 'e') - if type(Cmd) == type(function('call')) - return Cmd(a:lines) - endif if len(a:lines) > 1 augroup fzf_swap autocmd SwapExists * let v:swapchoice='o' @@ -224,6 +220,10 @@ function! s:common_sink(action, lines) abort execute 'e' s:escape(item) let empty = 0 else + let Cmd = get(a:action, key, bufexists(expand(item)) ? 'sbuffer' : 'e') + if type(Cmd) == type(function('call')) + return Cmd(a:lines) + endif call s:open(Cmd, item) endif if !has('patch-8.0.0177') && !has('nvim-0.2') && exists('#BufEnter')