Skip to content

Commit

Permalink
fix: spurious "Buffer would be deleted" warning
Browse files Browse the repository at this point in the history
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".
  • Loading branch information
justinmk committed Jun 18, 2023
1 parent 191341c commit bbf53b3
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions plugin/dirvish.vim
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ command! -bar -nargs=? -complete=dir Dirvish call dirvish#open(<q-args>)
command! -nargs=* -complete=file -range -bang Shdo call dirvish#shdo(<bang>0 ? argv() : getline(<line1>, <line2>), <q-args>)

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

0 comments on commit bbf53b3

Please sign in to comment.