Skip to content

Commit bbf53b3

Browse files
committed
fix: spurious "Buffer would be deleted" warning
Problem: Plugins (e.g. fugitive) may temporarily visit throwaway buffers (bufhidden != "hide"), then Dirvish refuses to leave the buffer and shows a "Buffer would be deleted" warning. Solution: Skip Dirvish's BufEnter handler if the current buffer has bufhidden != "hide".
1 parent 191341c commit bbf53b3

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

plugin/dirvish.vim

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ command! -bar -nargs=? -complete=dir Dirvish call dirvish#open(<q-args>)
77
command! -nargs=* -complete=file -range -bang Shdo call dirvish#shdo(<bang>0 ? argv() : getline(<line1>, <line2>), <q-args>)
88

99
func! s:isdir(dir)
10+
if &l:bufhidden =~# '\vunload|delete|wipe'
11+
return 0 " In a temporary special buffer (likely from a plugin).
12+
endif
1013
return !empty(a:dir) && (isdirectory(a:dir) ||
1114
\ (!empty($SYSTEMDRIVE) && isdirectory('/'.tolower($SYSTEMDRIVE[0]).a:dir)))
1215
endf

0 commit comments

Comments
 (0)