Hobo Chen

Learn Vim I

This tutorial may help you survive in the vim world.

The power tool for everyone!

Install Vim

1
2
3
4
5
sudo apt-get install vim # debian system
# or
sudo yum install vim # redhat system
# or
brew install vim # mac brew

First Commands

1
vim # to enter vim

Basic

When you get a new tool, first thing to do is trying not to throw it away, then is to learn to use it. – Hobo Chen

  • i insert
  • :w _filename saveas
  • :q quit

Basic vimrc

vimrc is configuration of vim, located in ~/.vimrc.
The following vimrc turns on syntax highlight and line numbers, and other minor improvements.

1
vim ~/.vimrc # to edit vimrc
1
2
3
4
5
syntax on
set ignorecase smartcase
set nu nocompatible cindent ai history=10000 laststatus=2
set sts=4 tabstop=4 expandtab guifont=Consolas:h14 shiftwidth=4
set foldmethod=syntax foldlevel=100 foldcolumn=1