Skip to content

Latest commit

 

History

History
110 lines (76 loc) · 2.41 KB

File metadata and controls

110 lines (76 loc) · 2.41 KB

Modes

  • Normal

    Startup mode. Normal mode can transition to all the other modes and vice versa (so going through normal - is the only (consistent) way to switch between any other 2 modes - Esc (enter from any other mode)

  • Command

    • : enter commands
  • Insert

    • i : type/edit - the usual editor experience
  • Visual (Select)

    • V visual line (whole lines)

    • v visual

    • Ctrl + v visual block

      Visual mode is the (only) way you can select text. As a bonus the selected text gets visually highlighted (so selction mode would be a more accurate name). After text is selected you can apply operations to the selected text (eg y, d,>,< see below)

vim-img

Normal Mode

i - Insert mode

  • o - line break after current and Insert mode
  • O - line break before current and Insert mode

: - Command mode

V visual line (whole lines) v visual Ctrl + v visual block

q -start/stop recording (beware accidental - hit again to toggle)

Edit
  • yank y - yank (ie copy to register) selection yy - yank current line

  • delete d - delete selection (cut) dd - delete line

    x - delete (char after cursor) X - backspace (delete char before cursor)

  • paste P - paste (from prev yank - ie register) on current line p - ..... on next line
    Cmd/Ctrl + V - paste clipboard (os)

  • undo u - undo ctrl-r - redo

  • indent selection > - in < - out
Move

0 - start of line $ - end of line

w - forward word b - backward word

Ctrl+u - 1/2 page Up Ctrl+d - 1/2 page Down

Ctrl+b - page Up Ctrl+f - page Down

gg - first line

G - last line

  • select all gg, V, G - (move to first line, enter visual line mode, move to last line)

Commands

:w - write file :r - read file

:q - quit (after saving) :q! - quit without saving

Esc- normal mode

:set number - toggle line numbers on :set nonumber - toggle line numbers off