+OK
  • Home
  • About
  • Categories
  • Tags
  • Archives

Vim Tutorial (2) Configure Vim

[TOC]

Configure ~/.vimrc and ~/.gvimrc

There are two setting files should be known: vimrc and gvimrc. They have two versions: system and user.

vimrc: the main vim configuration file

To get the system vimrc location:

:echo $VIM

To get the user vimrc location:

:echo $HOME

If you have never created user vimrc before, you need to create one by yourself. It is .vimrc, a hidden file.

The user .vimrc will always overwrite the system vimrc. Thus, you only need to change the user .vimrc to configure vim. It will not affect other users if Mac has other users.

gvimrc: the configuration file for Gvim

Gvim is Vim with GUI. It supports cursor, has more color and some other features. We only use gvimrc for gvim specific additions, e.g. theme color.

Here is the command to create .vimrc and .gvimrc from vimc_example.vim and gvimrc_example.vim

:e $VIMRUNTIME/vimrc_example.vim  
:saveas ~/.vimrc  
:e $VIMRUNTIME/gvimrc_example.vim  
:saveas ~/.gvimrc

" is used for comment in .vimrc

You may want to edit .vimrc in Terminal by:

$ open /Applications/TextEdit.app .vimrc

or in MacVim by:

:e .vimrc

Share on: Twitter ❄ Facebook ❄ Google+ ❄ Email

So what do you think of it? Do I miss something? Leave your comments below...

Comments
comments powered by Disqus

Related Posts

  • Vim Tutorial (1) Start Using Vim
  • Vim Tutorial (3) Theme and Font
  • Vim Tutorial (4) Add Plugins by Vundle
  • Edit LaTeX with Vim
  • Enable Alt Key Macros in LaTeX-Suite

  • « Vim Tutorial (1) Start Using Vim
  • Vim Tutorial (3) Theme and Font »

Published

Oct 9, 2015

Last Updated

Oct 9, 2015

Category

Coding

Tags

  • mac 5
  • vim 7

Contact

  • Creative Commons License
    "+OK" by Joe is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.
  • Powered by Pelican. Theme: Elegant by Talha Mansoor