Have a local Vimrc on every computer you work

3 Points

Durga Swaroop Perla Durga Swaroop Perla

7 years ago

A lot of times I have settings in my Vimrc that are specific to the current machine that I am working on. It could be information regarding the Spell file, Proxy information, or the TMP directory settings etc. And so its better to have a local vimrc with the machine specific settings and your main vimrc with the rest of your settings can directly be used in other machines without any changes.

So to use a local vimrc, just create a file .vimrc.local or .lvimrc in your home directory and put those local settings in that file. You can source those settings from your Vimrc as follows

if filereadable(glob("~/.vimrc.local")) 
    source ~/.vimrc.local

Sérgio Luiz Araújo Silva

Sérgio Luiz Araújo Silva 6 years ago

Nice use of glob, great to see how it works!