Can you edit your .vimrc file and reload it without having to restart Vim?
Best Answer
If you're editing it, you can reload it with:
:so %
% stands for current file name (see :h current-file) and :so is short for :source, which reads the content of the specified file and treats it as Vim code.
In general, to re-load the currently active .vimrc, use the following (see Daily Vim):
-u {vimrc}
Use the commands in the file {vimrc} for initializations. All the other
initializations are skipped. Use this to edit a special kind of files.
It can also be used to skip all initializations by giving the name "NONE".
See ":help initialization" within vim for more details.
If you still want your ~/.vimrc to be processed, try this:
vim -u ~/.vimrc
Add the following line to ~/.bashrc (or your shell's equivalent file if not bash) to have the -u switch added automatically:
alias vim="vim -u ~/.vimrc"
You won't be able to add something to ~/.vimrc to prevent /etc/vimrc from being read, because the system file is processed before your user file (see ":help init", section 3, "Execute Ex commands, from environment variables and/or files").
Best Answer
If you're editing it, you can reload it with:
%
stands for current file name (see:h current-file
) and:so
is short for:source
, which reads the content of the specified file and treats it as Vim code.In general, to re-load the currently active .vimrc, use the following (see Daily Vim):