Table of Contents

vi Editor

The vi editor comes standard on all Unix-like operating systems, and is a hell of an editor besides that! The learning curve is high, the editing paradigm is different from other editors. However, once you accept the “vi” lifestyle, there is no going back!

An open-source version if vi called VIM (Vi IMproved) is available on Linux and other GNU-software distributions. It rocks. Here, I present a quick introduction and reference to the standard vi editor.

vi modes

The vi editor has a few different modes used to communicate from the keyboard.

targets

ActionCommand
Until text formward / backward /regular_expression ?regular_expression
Start / First Char / End of Line 0 ^ $
End of File G
Top / Middle / Bottom of screen H M L
Up / Down / Left / Right k j h k
Scroll up line / half / full Ctrl+y Ctrl+u Ctrl+b
Scroll down line / half / full Ctrl+e Ctrl+d Ctrl+f
Goto line (target)
Goto char(x), backwards fx Fx
Repeat search, reverse search, char search n N ;
Column n n
Mark line as position x mx
Return to marked postion x `x
Word skipping forward, backward w b

Input and Manipulation Commands

Append after char/line a A
Insert after/prepend line i I
Replace character/Text r R
Change (target) / change End of line c target C
Insert line after / above o O
Repeat / Undo last change . u
Reverse case ~
Delete line / delete (target) dd / d target
Shift Left (line/Target) / Right « / > / >target

Cutting (Yanking) and Pasting

Copy line / target to buffer Y / y target
Cutting text See “delete”
Paste buffer p