Vim

Imported from Joe Martinez (http://jrmiii.com/2009/03/06/learning-vim-the-pragmatic-way.html)

Get Started. It's Free
or sign up with your email address
Vim by Mind Map: Vim

1. Cursor Movement

1.1. h,j,k,l

1.2. ctrl-f = page up

1.3. ctrl-b = page down

1.4. % = jump to matching brace

1.5. w = jump to end of words (punctuation)

1.6. W = jump by words

1.7. e = jump to end of words (punctuation)

1.8. E = jump to end of words

1.9. b = jump backward by words (punctuation)

1.10. B = jump backward by words

1.11. 0 = start of line

1.12. ^ = first character of line

1.13. $ = end of line

1.14. gg = go to first line

1.15. gd = go to def of the function or var under the cursor

1.16. [N]G = go to line N or last line

1.17. fx = move the cursor forward to the next occurrence of character x on the current line

1.18. ; = repeat last f command

1.19. tx = like fx but move right before the character

1.20. Fx = move the cursor backwards to the next occurrence of x

1.21. ) ,(= move the cursor to next, previous sentence

1.22. * = Read the string under the cursor and go to next occurrence

1.23. # = same as * but goes to previous occurrence

1.24. `. = Go to line last edited

1.25. Screenwise

1.25.1. H = move the cursor to the Highest line on the screen

1.25.2. M = move the cursor to the Middle of the screen

1.25.3. L = move the cursor to the Lowest line of the screen

1.26. Bookmarks

1.26.1. ma = Make a bookmark name a at the current cursor position

1.26.2. `a = Go to bookmark a (backtick, not single quote)

2. Insert Mode

2.1. i = insert mode at cursor

2.2. I = insert at the beginning of line

2.3. a = append after the cursor

2.4. A = append at the end of the line

2.5. o = open blank line below current line

2.6. O = open blank line above current line

2.7. Esc = exit insert mode

2.8. Completions (type a few chars then)

2.8.1. ctrl-n = next completion

2.8.2. ctrl-p = previous completion

3. Editing

3.1. r = replace a single character (!insert mode)

3.2. J = join line below to the current line

3.3. cc = change an entire line

3.4. cw = change to the end of word

3.5. c$ = change to the end of line

3.6. s = delete character at cursor and substitute text

3.7. S = delete line at cursor and substitute text

3.8. xp = transpose to letters

3.9. u = undo

3.10. ctrl-r = redo

3.11. . = repeat last command

3.12. ~ = switch case

3.13. g~iw = switch case of current word

3.14. gUiw = make current word uppercase

3.15. guiw = make current word lowercase

3.16. >> = indent line one column right

3.17. << = indent line one column left

3.18. == = auto-indent current line

4. Cut and Paste

4.1. dd = delete (cut) a line

4.2. dw = delete the current word

4.3. x = delete current character

4.4. X = delete previous character

4.5. D = delete to end of line

4.6. yy = yank (copy a line)

4.7. 2yy = yank (copy) 2 lines

4.8. yw = yank word

4.9. y$ = yank to end of line

4.10. p = put the clipboard after cursor/current line

4.11. P = put the clipboard before the cursor/current line

4.12. ]p = put the clipboard at the proper indentation

4.13. "a = use a register named a for the next yank/paste operation

5. Visual Mode

5.1. Marking Text

5.1.1. v = start visual mode

5.1.2. V = start linewise visual mode

5.1.3. ctrl-v = start blockwise visual mode

5.1.4. o = move to other end of marked area

5.1.5. U = upper case of marked area

5.1.6. O = move to Other corner of block

5.1.7. aw = mark a word

5.1.8. ab = a block with parens (braces)

5.1.9. aB = a block with brackets (curly braces)

5.1.10. ib = inner () block

5.1.11. iB =inner {} block

5.2. Commands

5.2.1. > = shift right

5.2.2. < = shift left

5.2.3. y = yank

5.2.4. d = delete

5.2.5. ~ = switch case

6. Search/Replace

6.1. /pattern = search for pattern

6.2. ?pattern = search backwards for pattern

6.3. n = repeat search in same direction

6.4. N = repeat search in opposite direction

6.5. :s/old/new/g = replace all old throughout file

6.6. :s/old/new/gc = replace all old with new and confirm each one

7. Exiting

7.1. :w = save

7.2. :wq = save and quit

7.3. :x = save and quit

7.4. :q = quit, but failed if unsaved

7.5. :q! = quit

8. Multi-File

8.1. :e filename = edit a file in a new buffer

8.2. :bn = go to next buffer

8.3. :bd = delete a buffer (close file)

8.4. :sp fn = open a file in new buffer and split window

8.5. ctrl w - window commands

8.5.1. ctrl-w s = split window

8.5.2. ctrl-w w = switch windows

8.5.3. ctrl-w q = quit a window

8.5.4. ctrl-w v = split windows vertically

8.6. Tab Commands

8.6.1. :tabe fn = edit file in new tab

8.6.2. gt = next tab

8.6.3. gT = previous tabs

8.6.4. :tabr = First tab

8.6.5. :tabl = Last tab

8.6.6. :tabm [N] = move current tab after tab N

9. Macros

9.1. qa = start recording a macro in register a

9.2. q = end recording

9.3. @a = replay macro in register a