I am using NVIM v0.7.2 on Arch Linux. Right now I got a problem with the plugins vim-easycomplete and nerdtree.

When I operate on one file and open another one, the first file stays in the buffer. On usual occasion, this wouldn't be a problem because I would move back and forth between the files when working on project. In my case as I'm doing the rust-lang/rustlings-course right now, I finish a task and continue with the next one, so after some time I got several buffers open.

The problem is that with each buffer because of vim-easycomplete, a new instance of rust-analyzer (language-server) attaches to a buffer. With several file open and only 8Gigs of RAM available, my memory gets eaten up fastly...

So my question is: is there a way to close the when opening a new file with NerdTree?

Thank you for reading!

EDIT: I've observed my memory usage a little more and it turned out that the high memory usage came from multiple instances of TabNine which is supported by vim-easycomplete. I turned it off with let g:easycomplete_tabnine_enable = 0 which is a work-around.

1 Answer 1


You can use:

  • List all current buffers: :buffers
  • Delete all open buffers: :%bd!
  • Delete a specific buffer: :bdelete <filename>
  • Delete buffer number 1: :1bd
  • Delete buffers from ranges 1 to 4: :1,4bd

You can also map command! BufOnly execute '%bd|edit #|normal `" in your .vimrc to delete all other buffers except the one you are currently working on. Let me know if this helps!

  • 1
    This is not exactly what I wanted to know. But it definitely brings me forwards! Thank you!
    – hmaier
    Jul 25, 2022 at 17:05
  • @hmaier I apologize if this didn’t help. I hope you end ip finding a solution. Have a good day :D Jul 25, 2022 at 17:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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