O'Reilly logo

vi and Vim Editors Pocket Reference, 2nd Edition by Arnold Robbins

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Vim—vi Improved

Vim is the most powerful and most popular of the vi clones currently in use. It is the default version of vi on most GNU/Linux systems.

Important Command-Line Options

-b

Start in binary mode.

-c command

Execute command at startup (POSIX version of the historical +command).

-C

Run in vi compatibility mode.

-f

For the GUI version, stay in the foreground.

-g

Start the GUI version of Vim, if Vim was compiled with support for the GUI.

-i viminfo

Read the given viminfo file for initialization instead of the default viminfo file.

-o [N]

Open N windows, if given; otherwise, open one window per file.

-O [N]

Like -o, but split the windows vertically.

-n

Don’t create a swap file: recovery won’t be possible.

-p

Open a new tab for each file named on the command line.

-q filename

Treat filename as the “quick fix” file.

-R

Start in read-only mode, setting the readonly option.

-s

Enter batch (script) mode. This is only for ex and intended for running editing scripts (POSIX version of the historical “–” argument).

-u vimrc

Read the given .vimrc file for initialization and skip all other normal initialization steps.

-U gvimrc

Read the given .gvimrc file for GUI initialization and skip all other normal GUI initialization steps.

-y

Enter “easy” mode, which provides more intuitive behavior for beginners.

-Z

Enter restricted mode (same as having a leading r in the name).

Vim Window Management

Vim lets you split the screen into multiple windows and control their size and placement.

Window management commands—ex

Command

Function ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required