
version 1.1 April 1st, 06 Esc vi / vim graphical cheat sheet normal mode toggle external play prev eol goto "soft" repeat next begin end "soft" bol next ~ case ! filter @·macro # ident $ %match ^ bol & :s * ident (sentence )sentence _ down + line goto 2 "hard" prev auto3 `· mark 1 2 3 4 5 6 7 8 9 0 bol - line =format ex next end replace back yank undo insert open paste begin end Q mode WWORD E WORD R mode T· 'till Y line U line I at bol O above P before { parag. } parag. next end 1,3 insert open paste1 record replace 'till undo misc misc q·macro w word e word r· char t· y yank u i mode o below p after [· ]· 1 append subst delete "back" eof/ screen join help screen ex cmd reg. bol/ A at eol S line D to eol F·find ch Ggoto ln H top J lines K L bottom : line "· spec | goto col subst 1,3 6 delete find extra repeat goto not aappend s char d f· char g· cmds h j k l ; t/T/f/F '·mk. bol \· used! 4 back- change visual prev prev un- 3 3 find quit screen indent Z· X space C to eol V lines B WORD N(find) Mmid'l < indent > ?· (rev.) 5 delete 1,3 visual prev next set extra change reverse repeat find z·cmds x char c v mode b word n (find) m·mark , t/T/f/F . cmd /· moves the cursor, or defines Main command line commands ('ex'): Notes: motion the range for an operator :w (save), :q (quit), :q! (quit w/o saving) (1) use "x before a yank/paste/del command :e f (open file f), to use that register ('clipboard') (x=a..z,*) command direct action command, if red, it enters insert mode :%s/x/y/g (replace 'x' by 'y' filewide), (e.g.: "ay$ to copy rest of line to reg 'a') :h (help in vim), :new (new file in vim), requires a motion afterwards, (2) type in a number before any action operator operates between cursor & Other important commands: to repeat it that number of times destination CTRL-R: redo (vim), (e.g.: 2p, d2w, 5i, d4j) special functions, CTRL-F/-B: page up/down, extra (3) duplicate operator to act on current line requires extra input CTRL-E/-Y: scroll line up/down, (dd = delete line, >> = indent line) CTRL-V: block-visual mode (vim only) commands with a dot need (4) ZZ to save & quit, ZQ to quit w/o saving q· a char argument afterwards Visual mode: bol = beginning of line, eol = end of line, Move around and type operator to act (5) zt: scroll cursor to top, mk = mark, yank = copy on selected region (vim only) zb: bottom, zz: center words: quux(foo, bar, baz); (6) gg: top of file (vim only), gf: open file under cursor (vim only) WORDs: quux(foo, bar, baz); For a graphical vi/vim tutorial & more tips, go to www.viemu.com - home of ViEmu, vi/vim emulation for Microsoft Visual Studio moves the cursor, or defines version 1.1 motion April 1st, 06 vi/vim lesson 1 - basic editing the range for an operator command direct action command, if red, it enters insert mode Esc normal mode eol "soft" $ ^ bol "hard" 0 bol next end replace WWORD E WORD R mode next end insert w word e word u undo i mode append ex cmd A at eol : line h j k l back- prev X space B WORD delete prev x char b word Basics: Extras: h j k l are vi/vim cursor keys – use them as they are much u to undo the last action – traditional vi has a single level, while vim closer than regular cursor keys! supports unlimited undo (CTRL - R to redo) Use i to enter insert mode, cursor turns from a block into a vertical 0 jumps directly to the beginning of the line, $ to the end, line, and you can type in text. Use Esc to return to normal mode. and ^ to the first non-blank Use x to delete the current character, or X to delete the one to Use w b e to move along ‘words’. A ‘word’ is a sequence of all the left alphanumeric or punctuation signs: quux(foo, bar, baz); Use A to go insert text at the end of the line (wherever you are Use W B E to move along WORDs. A 'WORD' is a sequence of in the line!) any non-blank characters: quux(foo, bar, baz); (Note: insert mode is actually very similar to a regular editor, you can use Use R to enter insert mode with an overstrike cursor, which cursor/navigation keys, backspace, delete…) types over existing characters. : w and press enter to save, : q and enter to quit. For the rest of the tutorial & a full cheat sheet, go to www.viemu.com - home of ViEmu, vi/vim emulation for Microsoft Visual Studio version 1.1 Learnedlearned learned in previous April 1st, 06 lessons vi/vim lesson 2 - operators & repetition motion moves the cursor, or defines vi / vim II - operators & repetition the range for an operator command direct action command, if red , it enters insert mode operator requires a motion afterwards, operates between cursor & Esc destination normal mode eol "soft" $ ^ bol 2 "hard" 1 2 3 4 5 6 7 8 9 0 bol next end replace back WWORD E WORD R mode T· 'till next end 'till insert w word e word t· u undo i mode append "back" ex cmd A at eol F·findfwd ch : line delete findfwd d f·tochar char h j k l back- visual prev X space V lines B WORD delete visual prev change repeat x char c v mode b word . cmd Basics: Extras: f , followed by another key, moves the cursor to the next instance Prepend a count to any command/motion to repeat it that number of that character on the current line, F does the same backwards. of times: dd 2 w to delete up to the second word. t and T do the same, but they stop right before the character. dd 2 t 2, to delete up to but not including the second comma. d (delete), followed, by any motion deletes the text between the 2 i repeats the text after you press (Esc) to finish the input session. cursor and that motion’s destination d w t , d f - …). Repeat operator ( c c or dd dd ) to operate on the current line. c (change) does the same, but leaves you in insert mode. Only in vim, vv enters visual mode. Move around with motions, the Some motions, such as j and k , are linewise – deletion includes text will be highlighted. Press an operator to operate on that selection. the full start/end lines. V enters visual-lines mode – like v , but selecting whole lines. repeats the last editing action: text input, delete or change, etc… v motion is recalculated at the new place. CTRL - selects rectangular blocks. For the rest of the tutorial & a full cheat sheet, go to www.viemu.com - home of ViEmu, vi/vim emulation for Microsoft Visual Studio Learnedlearned learned in previous version 1.1 lessons April 1st, 06 vi/vim lesson 3 - yank & paste motion moves the cursor, or defines the range for an operator command direct action command, if red , it enters insert mode operator requires a motion afterwards, operates between cursor & Esc destination extra special functions, normal requires extra input mode eol "soft" $ ^ bol 2 "hard" 1 2 3 4 5 6 7 8 9 0 bol next end replace back open paste WWORD E WORD R mode T· 'till O above P before next end insert open 'till undo paste w word e word t· y yank u i mode o below p after append "back" ex cmd reg. A at eol F·find ch : line "· spec 1,3 delete find d f· char h j k l back- visual prev X space V lines B WORD delete 1,3 visual prev change repeat x char c v mode b word . cmd Basics Extras Use y followed by any motion to ‘yank’ (copy). (“)2" and an a2" - z2" character before any yank/delete/paste command chooses a register. Use pv to paste after (if charwise, to the right, if linewise, below). An A2" - Z2" register before yank/delete means “append-copy”. Use Pv to paste before. 2 " 2" or 2 " +2 select the system clipboard. y y copies the current line. * y also works in visual mode. v Text deleted with ddd , c , xv … is also copied! 0 enters insert mode in a new empty line below the current one. O v does the same above the current line. For the rest of the tutorial & a full cheat sheet, go to www.viemu.com - home of ViEmu, vi/vim emulation for Microsoft Visual Studio Learnedlearned learned in previous version 1.1 lessons April 1st, 06 vi/vim lesson 4 - searching motion moves the cursor, or defines the range for an operator command direct action command, if red , it enters insert mode operator requires a motion afterwards, operates between cursor & Esc destination extra special functions, normal requires extra input mode prev eol "soft" next # ident $ ^ bol * ident 2 "hard" 1 2 3 4 5 6 7 8 9 0 bol next end replace back open paste WWORD E WORD R mode T· 'till O above P before next end insert open paste1 'till yank undo paste w word e word t· y u i mode o below p after append "back" ex cmd reg.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages8 Page
-
File Size-