Changing drive letter in NERDtree
Asked Answered
F

3

34

I started using NERDtree plugin on a a windows platform. I can't seem to find a way to change the drive letter. Going up all the way on the directory tree doesn't lead to the drive letter. Any ideas? (Yes, I know, it's going to be a simple answer)

Fundy answered 23/9, 2009 at 17:20 Comment(4)
Feel free to erase this questionFundy
No. Why delete the question. It's good.Ill
@amischiefr: who cares about google serps?Ill
+1 exactly the question on my lipsVirilism
M
31

If you want to go to your Z drive, for example, start it as:

:NERDTree Z:\
Marte answered 23/9, 2009 at 17:31 Comment(0)
A
4

If you use:

:NERDTree d:\

in the NERDTree window you will see it works. But now if you open(and edit) a file with NERDTree you will find it can not be saved, because the current working directory has not changed'; it is still in the old directory!

So if you want change the drive in NERDTree I advise you to perform the following 2 steps:

cd drive:\

:NERDTree .

where drive is the drive letter you want to change to, and . means change the NERDTree directory to the current working directory.

Now you can use NERDTree opening (or editing)the file in new directory now.

Aureole answered 13/6, 2013 at 14:1 Comment(1)
As an alternative solution, you can instead do set autochdir in your .vimrc, so that whenever you open a file (whether from NERDTree or otherwise), vim automatically does a cd to the path containing the file.Cherida
S
0

Not directly related, but if anyone finds themselves here from Google, ":e <location>" works in nvim-tree.

I'm putting this here because that's how I got here.

Sacring answered 6/12, 2022 at 4:30 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.