When I have a NERDtree panel and I save a Vim session (mksession [filename]), then open the session (vim -S filename), the panel is opened and tagged \"NERDtree\" but is not pop
Just decided to deal with this very issue myself. In my case, the session is created when I quit Vim with the following in my vimrc:
autocmd VimLeave * mksession! [filename]
I was also trying to open NERDTree automatically when Vim opened with:
autocmd VimEnter * NERDTree
The result was that my session opened with two instances of NERDTree, like described in the original post. My solution was to simply close NERDTree before saving the session, that way my auto-open call would only open the one instance of NERDTree.
My Solution
" Save session on quitting Vim
autocmd VimLeave * NERDTreeClose
autocmd VimLeave * mksession! [filename]
" Restore session on starting Vim
autocmd VimEnter * call MySessionRestoreFunction()
autocmd VimEnter * NERDTree
It's working like a charm for me so far. Hope this helps.