jistr / vim-nerdtree-tabs

NERDTree and tabs together in Vim, painlessly
Apache License 2.0
1.43k stars 129 forks source link

vim-nerdtree-tabs breaks :mksession #65

Open matjon opened 9 years ago

matjon commented 9 years ago

Hello, When I have NERDTreeTabs open and I save a session (through :mksession or :SessionSave from vim-session) and then I try to restore it, strange things happen.

Steps to reproduce:

  1. Open some files in vim:

    vim -p file.txt nohup.out .xsession-errors

  2. Make sure NERDTreeTabs is open.
  3. Execute :mksession /tmp/ses.vim
  4. Close vim.
  5. Open vim again.
  6. :source /tmp/ses.vim

I get the following errors (I have translated the error messages manually):

    "file.txt" 14L, 625C
    "file.txt" 14L, 625C
    Detected an error while processing /tmp/ses.vim:
    line   34:
    E95: Buffer with this name exists
    "nohup.out" 1L, 36C
    ".xsession-errors" 8244L, 683168C
    ".xsession-errors" 8244 lines --0%-- (2 of 3)
    line 58:
    E95: Buffer with this name exists
    ".xsession-errors" 8248L, 683644C
    "nohup.out" 1L, 36C
    "nohup.out" 1 line --100%-- (3 of 3)
    line   82:
    E95: Buffer with this name exists

and I have an additional buffer on every tab.

matjon commented 9 years ago

This is probably caused by the fact that all NERDTree windows have the same name "NERD_tree_1". That name apperas in session.vim multiple times.

NERDTree uses different buffer names for every instance: "NERD_tree_1", "NERD_tree_2", etc. (this is done in lib/nerdtree/creator.vim - s:Creator._nextBufferName() ). Nerdtree-tabs breaks it.

matjon commented 9 years ago

This bug could be probably replicated with native NERDTree - when I do

:NERDTreeMirror :NERDTreeMirrorOpen

I have the same buffer in two tabs.

mhinton commented 9 years ago

I have run into this error as well and it's pretty annoying. Right now I am working around it by closing NERDTree before doing mksession.

jpmorris commented 9 years ago

Same error. @mhinton 's workaround works for me