Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vim .vimrc custom location

Tags:

vim

I have used the bare bones of Vim under Ubuntu and now I would like to update my .vimrc file. Although Vim is indeed installed on my PC I don't seem to have a .vimrc file. I would like to add my .vimrc file but it really should go under my ~/.vim/ folder (I like to keep all my configurations in their respected folders).

How does one create a new vimrc file under this location in Ubuntu 13.04?

like image 758
John Crawford Avatar asked Aug 27 '13 22:08

John Crawford


1 Answers

Two options. (Take a look at :h vimrc which describes the default location and the -u option)

Create an alias to vim -u ~/.vim/vimrc this will cause vim to use that vimrc instead of ~/.vimrc

Or

Upgrade to vim 7.4. One of its default vimrc locations is ~/.vim/vimrc


You can also simulate the vimrc being in a different place.

Create a ~/.vimrc file that contains

runtime vimrc

It's job is to load the first file named vimrc in your runtime path. Which should be ~/.vim/vimrc

Or

You could just symlink ~/.vim/vimrc to ~/.vimrc

ln -s $HOME/.vim/vimrc $HOME/.vimrc

(I've heard some people have had problems with this but I haven't so far)

like image 52
FDinoff Avatar answered Nov 08 '22 10:11

FDinoff