sponsor Vim development Vim logo Vim Book Ad

basic Tip #626: open vimrc file

 tip karma   Rating -3/9, Viewed by 2649 

Read and edit this tip on the Vim tip wiki. The wiki may have a more recent version of this tip.

created:   December 24, 2003 3:27      complexity:   basic
author:   vim_user      as of Vim:   5.7

I edit my _vimrc file on a frequent basis.
I usually browse for the file then select it, but this can be a bit tedious so I made command that loads the file into a new window
Put this line into your _vimrc file
:com Openvimrc :new c:\vim\_vimrc

adjust the path as necessary - this assumes win32 platform
So now you can just  go ':Openvimrc' and you get the file to edit.

 rate this tip  Life Changing Helpful Unfulfilling 

<< Typing print statements faster and more ergonomically (esp in C++) | Customizing ftplugin, syntax etc. (eg for TeX) >>

Additional Notes

Anonymous, December 24, 2003 6:34
I'm using it slightly different way:
:cabbrev vi $VIM/_vimrc
:cabbrev gvi $VIM/_gvimrc
now whenever i want to tweak my setup i just type:
:e vi<space>
or
:vs vi<space>
or
:sp vi<space>

and voila!
( <space> is pressing spacebar key )
Nice tip, anyway! :)
Anonymous, December 26, 2003 6:32
Me too. I am always tweeking lil things in my 'rc file. Here is what i use to split open my 'rc file.

map <F7> :sp $HOME/_vimrc<cr>
" allows me to split-open my vimrc file in the current buffer

That way im only a quick hit of the F7 key away from my 'rc file.
[email protected], December 31, 2003 7:44
Not sure where I picked this mapping up from, but it works for me:

map ,v :e $vim\_vimrc<CR>
[email protected], January 1, 2004 22:56
Just adding to the previous note, to edit and source vimrc, I use
nmap ,v :sp $VIM\_vimrc
nmap ,s :source $VIM\_vimrc

Makes it easier to source changes immediately.
Shrinath
[email protected], November 22, 2004 19:42
Shrinath,

Even better, to source changes immediately, add to .vimrc:

au BufLeave ~/.vimrc :source ~/.vimrc

-Brian
If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
SourceForge.net Logo