4

When dealing with multiple splits, the split management commands are very useful: <C-W> R/r or <C-w><S-h>, for instance.

The issue I have is that when I have a NedTree buffer opened as a split, a command like <C-W>R or <C-W><S-h> will also move the NerdTree split which is obviously not the desired result.

I tried re-mapping these commands by including :NERTreeToggle<CR>:NERDTreeToggle<CR> but that doesn't work and is pretty clunky anyway.

Is there a way to "lock" the NerdTree split either on the left or the right side and have it be ignored by split manipulation commands ?

Running Turtle
  • 12,360
  • 20
  • 55
  • 73
  • 5
    No, all windows are equal before the law. – romainl Sep 08 '15 at 09:40
  • 2
    [This answer](http://stackoverflow.com/a/32400443) is relevant to your situation, even though it was posted in response to a completely different question. – Sato Katsura Sep 08 '15 at 13:15
  • +1 on that vimcasts video. Again, not an answer, but after getting frustrated with NERDTree, watching that video, and installing Tim Pope's [vim-vinegar](https://github.com/tpope/vim-vinegar) plugin, I'm glad I broke myself of NERDTree's grip on my workflow. – Jim Stewart Nov 13 '16 at 18:24

1 Answers1

0

What if you just closed Nerdtree before moving your splits thereby avoiding any of the ensuing issues:

nnoremap <C-W> :NERDTreeClose<CR><C-W>

Once you're done juggling your split screens, reopen Nerdtree. If you need to be fancy, combine closing, rotating splits and reopening Nerdtree in one mapping, something like:

nnoremap <C-W>r :NERDTreeClose<CR><C-W>r<bar>:NERDTreeToggle<CR>
gregory
  • 10,969
  • 2
  • 30
  • 42