Vim Editor in Linux / Unix / Solaris

Learn | Teach Open Source Technologies

Vim Editor in Linux / Unix / Solaris

url

The vim editor is a very powerful tool and has a very extensive built-in manual, which you can activate using the :help command when the program is started (instead of using man or info, which don’t contain nearly as much information). We will only discuss the very basics here to get you started.

What makes vim confusing to the beginner is that it can operate in two modes: command mode and insert mode. The editor always starts in command mode. Commands move you through the text, search, replace, mark blocks and perform other editing tasks, and some of them switch the editor to insert mode.

This means that each key has not one, but likely two meanings: it can either represent a command for the editor when in command mode, or a character that you want in a text when in insert mode.

Vim Installation:

Red Hat / CentOS / Fedora:

rpm -ivh vim-common-...rpm vim-minimal-...rpm vim-enhanced-...rpm vim-X11-...rpm
yum install vim-common vim-minimal vim-enhanced vim-X11

Ubuntu / Debian:

apt-get install vim vim-common vim-gnome vim-gui-common vim-runtime

Compiling Vim from source:

Download vim source from http://vim.org
 tar xzf vim-7.0.tar.gz
 cd vim70
 ./configure --prefix=/opt --enable-cscope
 make
 make install

The Vim Editor:

1

Vim Command Mode and Navigation:

2

 

Vim Navigation Keys:

3

Vim Insert Mode:

4

Vim Line Mode:

5.1

5

Vim Modes:

6

Vim Repeating Commands:

7

Vim Deleting Text:

8

Vim Changing Text:

9

Vim Copying and Pasting:

10

Vim Undo / Redo :

11

Vim Searching:

12