diff --git a/share/goodie/vim_cheat_sheet/template.tx b/share/goodie/vim_cheat_sheet/template.tx index 79be339ab..da3ebdb3e 100644 --- a/share/goodie/vim_cheat_sheet/template.tx +++ b/share/goodie/vim_cheat_sheet/template.tx @@ -10,9 +10,12 @@ : for $table.rows -> $row { - : for $row.cmds -> $cmd { - <: $cmd :>
- : } + : for $row.cmds -> $cmd { + <: $cmd :> + : if $~cmd.index != $~cmd.max_index { +
+ : } + : } <: $row.help :> diff --git a/share/goodie/vim_cheat_sheet/vim_cheat_sheet.html b/share/goodie/vim_cheat_sheet/vim_cheat_sheet.html index 3efd6623d..d2a5692e2 100644 --- a/share/goodie/vim_cheat_sheet/vim_cheat_sheet.html +++ b/share/goodie/vim_cheat_sheet/vim_cheat_sheet.html @@ -52,91 +52,91 @@ - h
+ h move cursor left - j
+ j move cursor down - k
+ k move cursor up - l
+ l move cursor right - w
+ w jump forwards to the start of a word - W
+ W jump forwards to the start of a word (words can contain punctuation) - e
+ e jump forwards to the end of a word - E
+ E jump forwards to the end of a word (words can contain punctuation) - b
+ b jump backwards to the start of a word - B
+ B jump backwards to the start of a word (words can contain punctuation) - 0
+ 0 jump to the start of the line - ^
+ ^ jump to the first non-blank character of the line - $
+ $ jump to the end of the line - G
+ G go to the last line of the document - 5G
+ 5G go to line 5 @@ -147,49 +147,49 @@ - i
+ i insert before the cursor - I
+ I insert at the beginning of the line - a
+ a insert (append) after the cursor - A
+ A insert (append) at the end of the line - o
+ o append (open) a new line below the current line - O
+ O append (open) a new line above the current line - ea
+ ea insert (append) at the end of the word - Esc
+ Esc exit insert mode @@ -200,67 +200,67 @@ - r
+ r replace a single character - J
+ J join line below to the current one - cc
+ cc change (replace) entire line - cw
+ cw change (replace) to the end of the word - c$
+ c$ change (replace) to the end of the line - s
+ s delete character and substitute text - S
+ S delete line and substitute text (same as cc) - xp
+ xp transpose two letters (delete and paste) - u
+ u undo - Ctrl+r
+ Ctrl+r redo - .
+ . repeat last command @@ -271,67 +271,67 @@ - v
+ v start visual mode, mark lines, then do a command (like y-yank) - V
+ V start linewise visual mode - o
+ o move to other end of marked area - Ctrl+v
+ Ctrl+v start visual block mode - O
+ O move to other corner of block - aw
+ aw mark a word - ab
+ ab a block with () - aB
+ aB a block with {} - ib
+ ib inner block with () - iB
+ iB inner block with {} - Esc
+ Esc exit visual mode @@ -342,31 +342,31 @@ - >
+ > shift text right - <
+ < shift text left - y
+ y yank (copy) marked text - d
+ d delete marked text - ~
+ ~ switch case @@ -381,73 +381,73 @@ - yy
+ yy yank (copy) a line - 2yy
+ 2yy yank (copy) 2 lines - yw
+ yw yank (copy) word - y$
+ y$ yank (copy) to end of line - p
+ p put (paste) the clipboard after cursor - P
+ P put (paste) before cursor - dd
+ dd delete (cut) a line - 2dd
+ 2dd delete (cut) 2 lines - dw
+ dw delete (cut) word - D
+ D delete (cut) to the end of the line - d$
+ d$ delete (cut) to the end of the line - x
+ x delete (cut) character @@ -458,31 +458,31 @@ - :w
+ :w write (save) the file, but don't exit - :wq
+ :wq write (save) and quit - :x
+ :x write (save) and quit - :q
+ :q quit (fails if there are unsaved changes) - :q!
+ :q! quit and throw away unsaved changes @@ -493,37 +493,37 @@ - /pattern
+ /pattern search for pattern - ?pattern
+ ?pattern search backward for pattern - n
+ n repeat search in same direction - N
+ N repeat search in opposite direction - :%s/old/new/g
+ :%s/old/new/g replace all old with new throughout file - :%s/old/new/gc
+ :%s/old/new/gc replace all old with new throughout file with confirmations @@ -534,63 +534,65 @@ - :e filename
+ :e filename edit a file in a new buffer - :bnext
- :bn
+ :bnext +
+ :bn go to the next buffer - :bprev
- :bp
+ :bprev +
+ :bp go to the previous buffer - :bd
+ :bd delete a buffer (close a file) - :sp filename
+ :sp filename open a file in a new buffer and split window - :vsp filename
+ :vsp filename open a file in a new buffer and vertically split window - Ctrl+ws
+ Ctrl+ws split window - Ctrl+ww
+ Ctrl+ww switch windows - Ctrl+wq
+ Ctrl+wq quit a window - Ctrl+wv
+ Ctrl+wv split window vertically @@ -601,56 +603,63 @@ - :tabnew filename
- :tabn filename
+ :tabnew filename +
+ :tabn filename open a file in a new tab - Ctrl+wt
+ Ctrl+wt move the current split window into its own tab - gt
- :tabnext
- :tabn
+ gt +
+ :tabnext +
+ :tabn move to the next tab - gT
- :tabprev
- :tabp
+ gT +
+ :tabprev +
+ :tabp move to the previous tab - #gt
+ #gt move to tab number # - :tabmove #
+ :tabmove # move current tab to the #th position (indexed from 0) - :tabclose
- :tabc
+ :tabclose +
+ :tabc close the current tab and all its windows - :tabonly
- :tabo
+ :tabonly +
+ :tabo close all tabs except for the current one