8

I recently started using Vim with NERDTree. The annoying thing is when I close the buffer, NERDTree expands to fill the rest of the screen, and I have to open another file and reopen NERDTree to get it back to the old layout.

Is there a way to "lock" NERDTree in place? Ideally, closing a buffer would replace it with another buffer that's hidden, or open a new blank buffer if no other buffers are open.

Thanks!

2

i do not think so. the only solution which comes to mind is to create a new keybinding which

  • :vnew
  • ctrl-w left
  • ctrl-w q

instead of just closing the current buffer.

| improve this answer | |
  • Sucks that you can't really do it, although that solution is a very nice workaround. Thanks! – breadjesus May 21 '10 at 15:04
4

Take a look at http://github.com/carlhuda/janus, it's a customised version of vim that let's you keep nerdtree locked on the left. It also includes many other popular plugins like command-t, ctags and ack.

| improve this answer | |
2

Try bufkill. It's built to solve this exact problem.

Instead of :bd to close your buffer, you use :BD. This prevents the window from being closed just because you killed the buffer. If there isn't another available buffer to replace it with, an empty buffer is opened.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.