Преглед изворни кода

Improve error message when deleting an unlisted buffer.

Deleting a listed buffer makes it unlisted.  Deleting an unlisted buffer
would do nothing, so `:bd` results in an error message from Vim such as:

```
Vim(bdelete):E516: No buffers were deleted: silent bdelete 1
```

Improve BufExplorer's error message in this case, letting the user know
that this is an unlisted buffer that must be wiped to remove it.
Michael Henry пре 9 месеци
родитељ
комит
c063fb7cc2
1 измењених фајлова са 5 додато и 0 уклоњено
  1. 5 0
      plugin/bufexplorer.vim

+ 5 - 0
plugin/bufexplorer.vim

@@ -1245,6 +1245,11 @@ endfunction
 " - "force_wipe"
 function! s:DeleteBuffer(bufNbr, mode)
     " This routine assumes that the buffer to be removed is on the current line.
+    if a:mode =~# 'delete$' && bufexists(a:bufNbr) && !buflisted(a:bufNbr)
+        call s:Error('Buffer ' . a:bufNbr
+                \ . ' is unlisted; must `wipe` to remove')
+        return
+    endif
     try
         " Wipe/Delete buffer from Vim.
         if a:mode == "wipe"