Reloading Your vimrc

If you’re tinkering with Vim’s config, did you know you can easily reload the settings file without restarting Vim? You basically just need to “source” the settings file: :source ~/.vimrc. You can use the abbreviated command, so it's just :so ~/.vimrc. If you use a plugin manager like Vundle and keep the list of plugins in ~/.vimrc, then you'll need to source it after changing the list of installed plugins. There's no need to quit and restart!

Once you get the hang of this, you’ll find you just open vimrc during editing sessions, without opening a new terminal and a fresh Vim to edit something.

There’s a really cool section in Learn Vimscript the Hard Way about editing your vimrc that suggests creating some handy mappings for opening and reloading the settings file.

Also, if you’re bogged down with a long settings file, why not use folds to tidy it up? And if you’re not too sure about folds, then I wrote an introduction to them back in 2012.

Update: Piotr S. wrote in to say you can make Vim automatically write your settings file by using autocmd bufwritepost .vimrc source $MYVIMRC.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.