Tuesday, November 25, 2008

Reload VIMRC

You can quickly and easily reload your vimrc with the following command.

:source $MYVIMRC

If you want to know what your current vimrc is, just do the following.

:echo $MYVIMRC

6 comments:

Mark Wilden said...

I don't see much point in sourcing your .vimrc unless you've been editing it. If so, then 'so %' is the quickest way to put your changes into effect. The only drawback with this is that if, say, you delete a :map from your .vimrc, merely sourcing it will leave that :map around. I wish I knew a way of starting everything from scratch (not just :maps) without exiting and restarting. Quibbles aside, rock on, Daily Vim!

Travis Whitton said...

I did not know about ':so %'. Awesome tip, and thanks for coming to the site!

dominiko said...

I have the following autocommand in my ~/.vimrc, so that whenever I write the file ~/.vimrc, it gets automatically sourced:

au! BufWritePost .vimrc source %

Alex said...

@dominiko: Nice. that will save me lots of typing :source...

Tim Holt said...

Anything wrong with this form?
:au! BufWritePost $MYVIMRC source $MYVIMRC

Anonymous said...

There is a point in doing source $MYVIMRC... when you work in screen with many tabs and many vim instances open.
Thanks for the tip.