Skip to content

When using NERDTreeMirror and mksession you get error Buffer with this name already exists #1443

Open
@giggio

Description

@giggio

Self-Diagnosis

Before creating an issue, take some time to search these resources for an answer. It's possible that someone else has already seen and solved your issue.

Environment

let s:test = expand('~/p/vimbug')
let &runtimepath = s:test . ',' . &runtimepath
let &packpath    = &runtimepath

function! ConfigureNERDTree()
  if exists("g:NERDTree")
    noremap <F2> :NERDTreeMirror<CR>:NERDTreeToggle<CR>
    " Open the existing NERDTree on each new tab.
    autocmd BufWinEnter * if &buftype != 'quickfix' && getcmdwintype() == '' | silent NERDTreeMirror | endif
  endif
endfunction
autocmd VimEnter * call ConfigureNERDTree()

Steps to Reproduce the Issue

  1. Create the provided .vimrc at ~/p/vimbug
  2. Run vim -u ~/p/vimbug/.vimrc -N -n
  3. Create 2 files, open each one in a tab. NERDTree buffer will be mirrored
  4. Run command :mksession!
  5. Quit vim
  6. Start vim again, this time with -S, so the session is loaded: vim -u ~/p/vimbug/.vimrc -N -n -S
  7. Error will show
  8. Inspect Session.vim, you will notice two calls to file NERD_tree_tab_1, the error is happening at the second one

Current Behavior (Include screenshots where appropriate.)

Errors when session is loaded.

Expected Result

Session loads as expected without error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions