28

How can I navigate to a file or folder in NERDTree and change the working directory to that folder (or the folder containining the file I'm on).

I know it's possible to keep NERDTree in sync with the NERDTree root (nerdtree and current directory), but I'm looking for a macro or something that would change the folder without having any impact on NERDTree itself.

3 Answers 3

34

You're looking for the cd mapping. Type this inside the NERDTree sidebar, and the current directory will be changed to the current entry's. See :help NERDTree-cd.

2
23

If you're inside the NERDTree buffer you can select the folder and press C to change the NERDTree root directory. Just type :help NERDTreeMenu and go to line 252 typing 252G or 252gg to check it yourself.

1
  • 3
    This is a capital 'C'.
    – emhohensee
    Nov 22, 2019 at 19:21
3

Press "t" when the cursor is on the folder, it will switch to a new buffer with the nerdtree in the subfolder you have selected

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.