Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apply vimrc changes without restarting

Tags:

vim

How can I have changes in my vimrc take effect without restarting VIM?

like image 358
satoru Avatar asked Nov 01 '10 02:11

satoru


People also ask

How do I edit my vimrc file?

Using file name completion, you could type :e $M then press Tab until you see the desired variable. If you only want to see the path, type :echo $M then press Tab to see the variable, and press Enter. In gvim, the Edit menu includes “Startup Settings” which will use $MYVIMRC to edit your vimrc file.

How do I permanently change Vim settings?

Enable the options for an individual file inside the Vim session using :set Open the desired file in Vim, type any option using the :set command in the Normal mode, and press Enter. 2. Enable the options permanently for all the files by specifying them in the local Vim configuration file ~/. vimrc.

How do I automatically generate vimrc?

The first line means you can open your vimrc from any vim buffer by typing your leader, then writing "vimrc." For example, my leader is set to comma, so if I'm in edit mode and I type ",vimrc" it opens my vimrc in a new tab. The second line automatically sources the changes to your vimrc when you save and close it.

Can you source vimrc?

Sourcing it is the same as typing each command in order. You source with the command :source (usually shortened to :so ). The only file sourced by default is the . vimrc ( _vimrc on windows) so that's a place you can keep all the commands you use to set up Vim every time.


1 Answers

You can just source it, like this:

:so ~/.vimrc 

Also, for convenience, it usually gets mapped to something quicker to type:

nmap <silent> <leader>sv :so $MYVIMRC<CR> 

And then of course, it would be nice to open vimrc a little quicker:

nmap <silent> <leader>ev :e $MYVIMRC<CR> 
like image 200
Peter Coulton Avatar answered Oct 09 '22 06:10

Peter Coulton