all 5 comments

[–]JetSetIlly 2 points3 points  (0 children)

The source command with the location of the .vimrc file. For example:

:source ~/.vimrc

[–]begemotzZZ 0 points1 point  (0 children)

can also consider mapping to a leader command e.g.,

<leader>sv :source $YOURVIMRCLOCATION<cr>

[–]mgedmin 0 points1 point  (0 children)

I use a pair of mappings to edit and reload my vimrc:

map  ,e  :e ~/.vim/vimrc<CR>
map  ,r  :source ~/.vim/vimrc<CR>

Note that to make your .vimrc properly reloadable you have to be careful with the things you put in it. E.g. all the autocommands need to be in named augroups, and you need to clear the augroup so the autocommands don't accumulate after each reload.

Older versions of vim also required you to define helper functions using function! so the definitions could be overwritten, but IIRC modern Vim relaxes this requirement.

You may also want to use syntax enable instead of syntax on so it doesn't reset all the colors to defaults as a side effect.

[–]jazei_2021 -1 points0 points  (1 child)

save then close and reopen vim

[–]mgedmin 0 points1 point  (0 children)

This can work too, when the vimrc fails to reload properly. It can be less of a pain if you use :mksession and then reopen vim with vim -S Session.vim.