meta data for this page
  •  

This is an old revision of the document!


VI / VIM

Short Version

EscC-C Exit insert mode
:w save
:q save

Long Version

Edit

i - insert before the cursor I - insert at the beginning of the line a - insert (append) after the cursor A - insert (append) at the end of the line o - append (open) a new line below the current line O - append (open) a new line above the current line

Clipboard

x Delete character dd Delete line (Cut) yy Yank line (Copy) p Paste P Paste before “*p / ”+p Paste from system clipboard “*y / ”+y Paste to system clipboar

Exit

:q Close file :qa Close all files :w Save :wq / :x Save and close file ZZ Save and quit :q! / ZQ Quit without checking changes

Visual mode

v Enter visual mode V Enter visual line mode <C-V> Enter visual block mode In visual mode d / x Delete selection s Replace selection y Yank selection (Copy)

Directions

h j k l Arrow keys <C-U> / <C-D> Half-page up/down <C-B> / <C-F> Page up/down

Words

b / w Previous/next word ge / e Previous/next end of word Line 0 (zero) Start of line

$ End of line

Character

fc Go forward to character c Fc Go backward to character c Document gg First line G Last line :{number} Go to line {number} {number}G Go to line {number} {number}j Go down {number} lines {number}k Go up {number} lines

Window

zz Center this line zt Top this line zb Bottom this line H Move to top of screen M Move to middle of screen L Move to bottom of screen

n Next matching search pattern N Previous match * Next whole word under cursor # Previous whole word under cursor

Operators

Usage

Operators let you operate in a range of text (defined by motion). These are performed in normal mode. d w Operator Motion Operators list d Delete y Yank (copy) c Change (delete then insert)

Indent right

< Indent left = Autoindent

Spell checking

:set spell spelllang=en_us Turn on US English spell checking ]s Move to next misspelled word after the cursor [s Move to previous misspelled word before the cursor z= Suggest spellings for the word under/after the cursor zg Add word to spell list zw Mark word as bad/misspelling zu / C-X (Insert Mode) Suggest words for bad word under cursor from spellfile