summaryrefslogtreecommitdiffstats
path: root/plugin
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2015-05-14 13:29:50 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2015-05-14 13:29:50 +0900
commit34e5e2dd8200fc2cf4b298cd2d5583f2875c7a70 (patch)
tree4d85716488d4567231d551a6b16a4aa50e5f9377 /plugin
parent2b7c3df66ba7cd9358a97001e27c012d9899444b (diff)
[vim] Use close+bufhidden=wipe instead of bd
Diffstat (limited to 'plugin')
-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