[vim] Use close+bufhidden=wipe instead of bd

This commit is contained in:
Junegunn Choi 2015-05-14 13:29:50 +09:00
parent 2b7c3df66b
commit 34e5e2dd82

View File

@ -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