Last Updated: October 12, 2018
·
7.788K
· rodnaph

Change Vim Working Directory

(This might be obvious to most Vim users, but it took me ages to realise I needed it)

I usually keep Vim open at my current project root, but when switching between projects I'd close Vim and then open a new one from the new project. Ignoring the fact it's trivial to change the current working directory from within Vim itself.

:cd /new/path

Now I don't need to close Vim ever again. :D

2 Responses
Add your response

Thanks for the tip! I use the ctrlp (https://github.com/kien/ctrlp.vim) plugin though, which is why I like to keep Vim at the project root.

over 1 year ago ·

Rooter is a Vim plugin which changes the working directory to the project root when you open a file. More accurately, it'll do this when you open a typical webapp file. These files are identified by their extension.
http://www.vim.org/scripts/script.php?script_id=4145

over 1 year ago ·