mirror of
https://github.com/preservim/nerdtree.git
synced 2024-11-22 11:32:25 +08:00
Merge pull request #756 from mboughaba/master
Previously, deleting a file in the NERDTree with "md" would cause a new buffer to be created to fill the window(s) occupied by a buffer on the file. This pull request makes it so that a new buffer is not created. Instead, the next buffer in the buffer list fills the window. Fixes #755.
This commit is contained in:
parent
f554c20cb2
commit
a8c6245057
|
@ -55,7 +55,22 @@ function! s:promptToDelBuffer(bufnum, msg)
|
|||
" Is not it better to close single tabs with this file only ?
|
||||
let s:originalTabNumber = tabpagenr()
|
||||
let s:originalWindowNumber = winnr()
|
||||
exec "tabdo windo if winbufnr(0) == " . a:bufnum . " | exec ':enew! ' | endif"
|
||||
" Go to the next buffer in buffer list if at least one extra buffer is listed
|
||||
" Otherwise open a new empty buffer
|
||||
if v:version >= 800
|
||||
let l:listedBufferCount = len(getbufinfo({'buflisted':1}))
|
||||
elseif v:version >= 702
|
||||
let l:listedBufferCount = len(filter(range(1, bufnr('$')), 'buflisted(v:val)'))
|
||||
else
|
||||
" Ignore buffer count in this case to make sure we keep the old
|
||||
" behavior
|
||||
let l:listedBufferCount = 0
|
||||
endif
|
||||
if l:listedBufferCount > 1
|
||||
exec "tabdo windo if winbufnr(0) == " . a:bufnum . " | exec ':bnext! ' | endif"
|
||||
else
|
||||
exec "tabdo windo if winbufnr(0) == " . a:bufnum . " | exec ':enew! ' | endif"
|
||||
endif
|
||||
exec "tabnext " . s:originalTabNumber
|
||||
exec s:originalWindowNumber . "wincmd w"
|
||||
" 3. We don't need a previous buffer anymore
|
||||
|
|
Loading…
Reference in New Issue
Block a user