Currently the NERDTree buffer opens for every file that you open. If I'm writing to *.scala, *.py, etc. But I don't want this to happen for certain files that I'm writing (such as Haskell). For example, when I'm opening a Haskell file, I don't want the NERDTree buffer to open as soon as I type in vim file.hs
in the terminal. Does anyone know how to get this to work?
How to disable NERDTree buffer when opening certain file types
You probably use something like this in your ~/.vimrc
to automatically open NERDTree:
:autocmd VimEnter * NERDTree
You just need to add a conditional, e.g. to suppress the opening when any files are passed to Vim:
:autocmd VimEnter * if argc() == 0 | NERDTree | endif
As the VimEnter command fires after buffers have been loaded, you can also check for the current 'filetype'
value to suppress only, say, Haskell files:
:autocmd VimEnter * if &filetype !=# 'haskell' | NERDTree | endif
Thanks @Ingo-Karat! That worked perfectly. I need to look more into Vimscript. –
Gulosity
Glad I could help. Don't forget to close the question by accepting the answer (click on the check mark). –
Cameroncameroon
© 2022 - 2024 — McMap. All rights reserved.