Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NERDTree keeps 'No Name' buffer after deleting current node 'md' #755

Closed
mboughaba opened this issue Nov 1, 2017 · 0 comments
Closed

NERDTree keeps 'No Name' buffer after deleting current node 'md' #755

mboughaba opened this issue Nov 1, 2017 · 0 comments

Comments

@mboughaba
Copy link
Contributor

To assist in resolving your issue, provide as much information as possible, in place of the ellipses () below.


Environment: Describe your Vim/NERDTree setup.

  • Operating System: Archlinux, Linux Opensuse and Window 7
  • GVim version :version: 8.0 Included patch 1-69
  • Vim version :version: 8.0 Included patch 1-2
  • NERDTree version git rev-parse --short HEAD: f554c20
  • NERDTree settings applied in your vimrc, if any:
    let NERDTreeWinPos = "left"
    let NERDTreeWinSize = 35
    let NERDTreeIgnore = ['.job$', '^CVS$', '.orig', '.log$']
    let g:NERDTreeDirArrows = 0
    let g:NERDTreeStatusline = "%f"
    let g:NERDTreeDirArrowExpandable = ''
    let g:NERDTreeDirArrowCollapsible = ''

Process: List the steps that will recreate the issue.

  1. Open several buffers from the tree
  2. Delete one file from the tree using md
    NERDTree ask for confirmation to delete the file and delete the associated buffer if open
  3. confirm delete file and buffer with 'y'

Current Result: Describe what you you currently experience from this process.

Buffer is actually deleted but it remains open as 'No Name'

To completely remove residue buffer one should call ':Bdelete'

/!\ I tested (re) this several time before submitting the issue and notice that sometime:

  • residue buffer is replaced with newly open file
  • If deleted buffer was the first one to be opened it will be removed completely without leaving any residue buffer
  • This is occurring only if the file to be deleted is the currently active buffer

Optional

Screenshot(s):

image

Possible Fix: (Have you poked around in the code?)
The setting below doesn't affect the results.

"Automatically delete the buffer after deleting or renaming a file
if !exists("g:NERDTreeAutoDeleteBuffer")
  let g:NERDTreeAutoDeleteBuffer = 0
endif

There is one function to be reviewed

function! s:promptToDelBuffer(bufnum, msg)

I think the issue will be solved by changin the line below in s:promptToDelBuffer:

  • from
exec "tabdo windo if winbufnr(0) == " . a:bufnum . " | exec ':enew! ' | endif"
  • to
exec "tabdo windo if winbufnr(0) == " . a:bufnum . " | exec ':bnext! ' | endif"
mboughaba added a commit to mboughaba/nerdtree that referenced this issue Nov 1, 2017
…ervim#755

Go to the new buffer in buffer list instead of creating a new buffer.
If only one buffer is open, now we go back to nerdtree buffer.
mboughaba added a commit to mboughaba/nerdtree that referenced this issue Nov 1, 2017
…ervim#755 (closes preservim#755) preservim#756

Go to the next buffer in buffer list if at least one extra buffer is listed. Otherwise open a new empty buffer.
mboughaba added a commit to mboughaba/nerdtree that referenced this issue Nov 1, 2017
…ervim#755 (closes preservim#755) preservim#756

Check vim version before getting listed buffer count.
Old behavior is kept for v 7.0 and 7.1.
starting from 7.2 new behavior will be applicable. Switch to open buffer if any instead of opening a new one.
mboughaba added a commit to mboughaba/nerdtree that referenced this issue Nov 1, 2017
NERDTree keeps 'No Name' buffer after deleting current node 'md' preservim#755 (closes preservim#755) preservim#756
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant