Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

set .vim home directory to something specific

Tags:

vim

macvim

My projects are all under /Users/username/workspace/my_project where /Users/username/ is $HOME.

I want macvim to always have the home as /Users/username/workspace/my_project instead of /Users/username/.

I understand set autochdir sets the home to whatever the current file's directory is, but this is not what I want. Also I'm using NerdTree if that helps.

like image 306
Matilda Avatar asked Dec 17 '12 07:12

Matilda


People also ask

How do I change working directory in Vim?

Every command you run has its own current working directory. When you start a terminal emulator, your first cwd is your home directory ( /home/user on Linux, /Users/user on macOS, C:\\Users\user on Windows), and then you can use cd to change the working directory.

Where is the default Vimrc?

vimrc , and Vim files of current user are located inside ~/. vim/ . The global configuration file is located at /etc/vimrc . Global Vim files such as defaults.

How do I edit Vimrc in Windows?

Opening vimrc Using file name completion, you could type :e $M then press Tab until you see the desired variable. If you only want to see the path, type :echo $M then press Tab to see the variable, and press Enter. In gvim, the Edit menu includes "Startup Settings" which will use $MYVIMRC to edit your vimrc file.


1 Answers

Do you want Vim's working directory to be ~/my_project?

Add cd ~/my_project to your ~/.vimrc.

Do you want all your plugins and colorschemes to be loaded from ~/my_project, however silly it is?

See :help runtimepath.

like image 119
romainl Avatar answered Oct 07 '22 00:10

romainl