Title: Theory / Unimportant / CS / Softw / vim / Long
Tags: Cursor Movement Editing WorkingWithMultipleFiles CutandPaste (VisualMode) MarkingText seen_description Insert Mode SearchandReplace Exiting VisualCommands Files Global Macros Marks Multiple Search Registers
On every note of this deck, unless a note says otherwise:
Context: vim

Instruction: :help keyword
Effect: Open help for keyword

Instruction: :saveas file
Effect: Save file as

Instruction: :close
Effect: Close Current Pane

Instruction: K
Effect: Open man page for word under cursor

Instruction: h
Effect: Move Cursor Left

Instruction: j
Effect: Move Cursor Down

Instruction: k
Effect: Move Cursor Up

Instruction: l
Effect: Move Cursor Right

Instruction: H
Effect: Move to top of screen

Instruction: M
Effect: Move to middle of screen

Instruction: L
Effect: Move to bottom of screen

Instruction: w
Effect: Jump forwards to the start of a word

Instruction: W
Effect: Jump forwards to the start of a word (words can contain punctuation)

Instruction: e
Effect: Jump forwards to the end of a word

Instruction: E
Effect: Jump forwards to the end of a word (words can contain punctuation)

Instruction: b
Effect: Jump backwards to the start of a word

Instruction: B
Effect: Jump backwards to the start of a word (words can contain punctuation)

Instruction: %
Effect: Move to matching character (default supported pairs: '()', '{}', '[]' - use :h matchpairs in vim for more info)

Instruction: 0
Effect: Jump to the start of the line

Instruction: ^
Effect: Jump to the first non-blank character of the line

Instruction: $
Effect: Jump to the end of the line

Instruction: g_
Effect: Jump to the last non-blank character of the line

Instruction: gg
Effect: Go the first line of the document

Instruction: G
Effect: Go to the last line of the document

Instruction: 5G
Effect: Go to line 5

Instruction: fx
Effect: Jump to the next occurrence of character x

Instruction: tx
Effect: Jump to before next occurrence of character x

Instruction: Fx
Effect: Jump to previous occurence of character x

Instruction: Tx
Effect: Jump to after previous occurrence of character x

Instruction: ;
Effect: Repeat previous f, t, F, or T movement

Instruction: ,
Effect: Repeat previous f, t, F, or T movement, backwards

Instruction: }
Effect: Jump to next paragraph (or function/block, when editing code)

Instruction: {
Effect: Jump to previous paragraph (or function/block, when editing code)

Instruction: zz
Effect: Center cursor on screen

Instruction: Ctrl + e
Effect: Move screen down one line (without moving cursor)

Instruction: Ctrl + y
Effect: Move screen up one line (without moving cursor)

Instruction: Ctrl + b
Effect: Move back one full screen

Instruction: Ctrl + f
Effect: Move forward one full screen

Instruction: Ctrl + d
Effect: Move forward 1/2 a screen

Instruction: Ctrl + u
Effect: Move back 1/2 a screen

Instruction: i
Effect: Insert before the cursor

Instruction: I
Effect: Insert at the beginning of the line

Instruction: a
Effect: Insert (append) after the cursor

Instruction: A
Effect: Insert (append) at the end of the line

Instruction: o
Effect: Append (open) a new line below the current line

Instruction: O
Effect: Append (open) a new line above the current line

Instruction: ea
Effect: Insert (append) at the end of the word

Instruction: Esc
Effect: Exit insert mode

Instruction: r
Effect: Replace a single character

Instruction: J
Effect: Join line below to the current one with one space in between

Instruction: gJ
Effect: Join line below to the current one without space in between

Instruction: gwip
Effect: Reflow Paragraph

Instruction: cc
Effect: Change (replace) entire line

Instruction: c$
Effect: Change (replace) to the end of the line

Instruction: ciw
Effect: Change (replace) entire word

Instruction: cw
Effect: Change (replace) to the end of the word

Instruction: s
Effect: Delete character and substitute text

Instruction: S
Effect: Delete line and substitute text (same as cc)

Instruction: xp
Effect: Transpose two letters (delete and paste)

Instruction: u
Effect: Undo

Instruction: Ctrl + r
Effect: Redo

Instruction: .
Effect: Repeat last command

Instruction: v
Effect: Start visual mode, mark lines, then do a command (like y-yank)

Instruction: V
Effect: Start linewise visual mode

Instruction: o
Effect: Move to other end of marked area

Instruction: Ctrl + v
Effect: Start visual block mode

Instruction: O
Effect: Move to other corner of block

Instruction: aw
Effect: Mark a word

Instruction: ab
Effect: A block with ()

Instruction: aB
Effect: A block with {}

Instruction: ib
Effect: Inner block with ()

Instruction: iB
Effect: Inner block with {}

Instruction: Esc
Effect: Exit visual mode

Instruction: >
Effect: Shift text right

Instruction: <
Effect: Shift text left

Instruction: y
Effect: Yank (copy) marked text

Instruction: d
Effect: Delete marked text

Instruction: ~
Effect: Switch case

Instruction: :reg
Effect: Show registers content

Instruction: "xy
Effect: Yank into register x

Instruction: "xp
Effect: Paste contents of register x

Instruction: :marks
Effect: List of marks

Instruction: ma
Effect: Set current position for mark A

Instruction: 'a
Effect: Jump to position of mark A

Instruction: y'a
Effect: Yank text to position of mark A

Instruction: qa
Effect: Record macro a

Instruction: q
Effect: Stop recording macro

Instruction: @a
Effect: Run macro a

Instruction: @@
Effect: Rerun last run macro

Instruction: yy
Effect: Yank (copy) a line

Instruction: 2yy
Effect: Yank (copy) 2 lines

Instruction: yw
Effect: Yank (copy) the characters of the word from the cursor position to the start of the next word

Instruction: y$
Effect: Yank (copy) to end of line

Instruction: p
Effect: Put (paste) the clipboard after cursor

Instruction: P
Effect: Put (paste) before cursor

Instruction: dd
Effect: Delete (cut) a line

Instruction: 2dd
Effect: Delete (cut) 2 lines

Instruction: dw
Effect: Delete (cut) the characters of the word from the cursor position to the start of the next word

Instruction: D
Effect: Delete (cut) to the end of the line

Instruction: d$
Effect: Delete (cut) to the end of the line (alternative)

Instruction: x
Effect: Delete (cut) character

Instruction: :w
Effect: Write (save) the file, but don't exit

Instruction: :w !sudo tee %
Effect: Write out the current file using sudo

Instruction: :wq or :x or zz
Effect: Write (save) and quit

Instruction: :q
Effect: Quit (fails if there are unsaved changes)

Instruction: :q! or ZQ
Effect: Quit and throw away unsaved changes

Instruction: :wqa
Effect: Write (save) and quit on all tabs

Instruction: /pattern
Effect: Search for a pattern

Instruction: ?pattern
Effect: Search backward for pattern

Instruction: \vpattern
Effect: 'Very magic' pattern: non-alphanumeric characters are interpreted as special regex symbols (no escaping needed)

Instruction: n
Effect: Repeat search in same direction

Instruction: N
Effect: Repeat search in opposite direction

Instruction: :%s/old/new/g
Effect: Replace all old with new throughout file

Instruction: :%s/old/new/gc
Effect: Replace all old with new throughout file with confirmations

Instruction: :noh
Effect: Remove highlighting of search  matches

Instruction: :vimgrep /pattern/ {file}
Effect: Search for pattern in multiple files

Instruction: :cn
Effect: Jump to the next match

Instruction: :cp
Effect: Jump to the previous match

Instruction: :copen
Effect: Open a window containing the list of matches

Instruction: :e file
Effect: Edit a file in a new buffer

Instruction: :bnext or :bn
Effect: Go to the next buffer

Instruction: :bprev or :bp
Effect: Go to the previous buffer

Instruction: :bd
Effect: Delete a buffer (close a file)

Instruction: :ls
Effect: List all open buffers

Instruction: :sp file
Effect: Open a file in a new buffer and split window

Instruction: :vsp file
Effect: Open a file in a new buffer and vertically split window

Instruction: Ctrl + ws
Effect: Split window

Instruction: Ctrl + ww
Effect: Switch windows

Instruction: Ctrl + wq
Effect: Quit a window

Instruction: Ctrl + wv
Effect: Split window vertically

Instruction: Ctrl + wh
Effect: Move cursor to the left window (vertical split)

Instruction: Ctrl + wl
Effect: Move cursor to the right window (vertical split)

Instruction: Ctrl + wj
Effect: Move cursor to the window below (horizontal split)