Pages

Sunday, April 7, 2019

What is .Vimrc file

What is .vimrc

A file that contains initialization commands is called a "vimrc" file

Types of .vimrc
  • User vimrc 
  • System vimrc

Location of vimrc
  • User vimrc in $HOME (The user vimrc file often does not exist until created by the user. If you cannot find $HOME/.vimrc (or $HOME/_vimrc on Windows) then you can, and probably should, just create it.)
  • The system vimrc is normally under /etc in linux. The system vimrc should normally be left unmodified and it is not a good place you keep your personal settings. If you modify this file your changes may be overwritten if you ever upgrade vim. Also, changes here will affect other users on a multi-user system. In most cases, settings in the user vimrc will override settings in the system vimrc.

TIPS

1) :scriptnames list all the .vim files that Vim loaded for you, including your .vimrc file.

2) :e $MYVIMRC open & edit the current .vimrc that you are using, then use Ctrl + G to view the path in status bar.

To create your vimrc, start up vim and do one of the following:

3) :e $HOME/.vimrc  " on Unix, Mac or OS/2

Examples of vimrc contents

# Show line numbers
set number

# Show file stats
set ruler

No comments:

Post a Comment