跳至主要内容

vim

History & Pronounced

  • Vi ( Visual ) -> Bill Joy
  • Vim /vim/ -> Bram Moolenaar

Vim is pronounced as one word, like Jim, not vi-ai-em. It's written with a

capital, since it's a name, again like Jim.

Learning curve

Switch Between Modes

  • normal mode
    • switch on
      • <ESC> / <C-c> / <C-[> [suggested]
    • switch off
      • i / o / a / s / c
  • visual mode
    • switch on
      • v / <C-v>
    • switch off
      • <ESC> / <C-c> / <C-[> [suggested]
  • insert mode
    • switch on
      • i / o / a / s / c
    • switch off
      • <ESC> / <C-c> / <C-[> [suggested]
  • command mode
    • switch on
      • :
    • switch off
      • <ESC> / <C-c> / <C-[> [suggested]

Edit Action

keynameintentionusing with text objectnotes
vvisualselectOu casing ~ toggle casing
yyankcopy selectionO
ddeletedelete selection with scopeO
cchangedelete and insert with scopeO
iinsertinsert chars before cursorX
aappendappend chars after cursorX
xdeletedelete selectionX
oopenopen a new lineX
ssubstitutedelete selection and insertX
ppastepaste the copy in clipboardX
uundoundo actionX
rreplacereplace a charX
keynameintentionusing with text objectnotes
ffindfind charX
ggogo toXd definition gg top G end <C-o> back cursor
bbackback to word startX
eendforward to word endX
wwordforward to next word startX
%pairsjump between pairsX
/searchsearch a word with regexX<C-n> next <C-N> previous
{blocksearch a word with regexX<C-n> next <C-N> previous

Commands

  • stream editor (sed)
  • split
  • switch buffer <C-w> direction <C-w>*2

Text Object ( Scope + Noun )

Scope

keynameintention
iinnerinner scope
aaroundaround scope

Noun

keyname
wword
pparagraph
bblock
iindentation
{curly brackets
[square brackets
(round brackets
'quotation mark
`back tick

Cheat Sheet