I recently restored my computer to a clean install and copied over my dot files. MacVim behaves quite a bit differently than my previous install.

One main thing is that NerdTree no longer collapses all the sub directories and sets the cursor to the current root. After opening a few files, it makes it a huge pain to navigate NerdTree as there are several sub directories open.

I have scoured the backup of my computer for any additional config files for vim and NerdTree and haven't found anything. I've also searched extensively through the web to try and solve my issue but it seems impossible to find anything other than the most popular NerdTree questions.

I have been able to find the NerdTree commands that do what I want, but I don't know how to automate it for when I open NerdTree. Also, I open NerdTree using the vim e[edit] command to the current directory. Something like :e.

The following is what I would like to happen when I open up NerdTree :e.:

  • P - go to root
  • X - close all children recurs­ively
  • R - refresh current root (Not sure if this is necessary)

I haven't installed any additional plugins since my previous install. The only one that I have that I could think would have an affect on the behaviour of NerdTree is airblade/vim-rooter, which keeps my root directory at the root of a git repo I am in.

Any help is greatly appreciated.


  • Using MacVim v8.0.237
  • Mac OS Sierra
  • I've not used NerdTree before. When you have NerdTree open does it have its own filetype? (I.e. with NerdTree open what does set ft? print?) – Tumbler41 Jan 30 '17 at 22:40
  • @Tumbler41 filetype=nerdtree – Chad Fawcett Jan 31 '17 at 0:30
  • If your config hasn't changed, perhaps your version of NerdTree has. – Andy Stewart Feb 9 '17 at 12:55

Your Answer

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

Browse other questions tagged or ask your own question.