summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugin/fzf.vim12
1 files changed, 8 insertions, 4 deletions
diff --git a/plugin/fzf.vim b/plugin/fzf.vim
index ae266464..89794d95 100644
--- a/plugin/fzf.vim
+++ b/plugin/fzf.vim
@@ -272,7 +272,7 @@ function! s:split(dict)
tabnew
endif
finally
- setlocal winfixwidth winfixheight
+ setlocal winfixwidth winfixheight buftype=nofile bufhidden=wipe nobuflisted
endtry
endfunction
@@ -283,10 +283,14 @@ function! s:execute_term(dict, command, temps)
let fzf = { 'buf': bufnr('%'), 'dict': a:dict, 'temps': a:temps }
function! fzf.on_exit(id, code)
let tab = tabpagenr()
- let wnr = winnr()
- execute 'bd!' self.buf
- if winnr() == wnr && tabpagenr() == tab
+ if bufnr('') == self.buf
+ " We use close instead of bd! since Vim does not close the split when
+ " there's no other listed buffer
close
+ " FIXME This should be unnecessary due to `bufhidden=wipe` but in some
+ " cases Neovim fails to clean up the buffer and `bufexists('[FZF]')
+ " returns 1 even when it cannot be seen anywhere else. e.g. `FZF!`
+ silent! execute 'bd!' self.buf
endif
if s:ptab == tab
wincmd p