KEMBAR78
Vi Vim Cheat Sheet and Tutorial | PDF
0% found this document useful (0 votes)
158 views8 pages

Vi Vim Cheat Sheet and Tutorial

xyz

Uploaded by

Moumita Das
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
158 views8 pages

Vi Vim Cheat Sheet and Tutorial

xyz

Uploaded by

Moumita Das
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 8
IEsc ‘ome |i (@ eel [# een |[S_ 6a) sa [Benes aes |e] nese (etome) ise | 3 4 Oe" |[- sax |= ce] nse Watota EE wi I Sone|[P ease] {pate |[F sce qessserdl| W wars |[@_ soci |[T- i nese |[O Skee [P sate || [+ mise | ]> mise vrs eet|[Desy K * [[Laseal[: siset]["- 58 [ta [Asonend||S || dae Ke # > | ee ee|\- 2. (Z; swie®| [XK Bpee| [Cae [> tase] (nd [z-essz"| [x soe ||ae| sand ave. "ge || soa HOT heap ea speratoe Rotee, direct action command, if red, itenters insert mode Fequires extra input ‘commands with a dot need ‘char argument afterwards (RUIFOST] Bast] Bay WORDs: Bar.) Baz) words: Fora graphical vi/vim tutorial & more ti before a yank/paste/del command (Sipboard (3) duplicate operator to act on current tine ‘ Ga acheteine, > indent ine) to save & quit, ZQ to quit w/o saving Visual mode: ‘Move around and type operator to act on selected region (vim only), scroll cursor to top, bottom, zz: center top of file (vim only f open file under cursor (vim only) to_www.viemu.com home of ViEmu, vi/vim emulation for Mierosoft Visual Studio vi/vim lesson 1 - basic editing JG) EI are vi/vim cursor keys - use them as they are much closer than regular eursor keys Use I}to enter insert mode, cursor turns from a block into a vertical ine, and you can type in text. Use [Ese] to return to normal mode. Use ix]to delete the current character, or[] to delete the one to thelen Use [i] to go insert text at the end of the line (wherever you are in theline!) ote: insert mode is actually very similar to a regular editor, you ean use ‘eursor/navigation keys, backspace, delete.) wales | _|_ lashes! belivherh ot [BJto undo the last action traditional vihas a single level, while vim Supports unlimited undo (CTRL.-[Rlvo redo) [D]iumps directly to the beginning ofthe ine, [iJto the end, snd [ato the first non-blank tomove slong words’. A‘word’ isn sequence ofall Alphanumericor punctuation signs: GUESS] Bas]] BS] ‘Use [HIB] to move along WORDs. A "WORD is a sequence of any non blank characters EE] BET Uae (R] to enter insert mode with an overstrike cursor, which types over existing characters. [Elia|and press enter to save, E[qJand enter to qui. \__Forthe rest of the tutorial & a full cheat sheet, go to www.viemu.com - home of ViEmu, vi/vim emulation for Microsoft Visual Studio | 3 4 5 6 7 8 9 followed by another key, moves the cursor to the next instance of that character on the current line, [BI does the same backward: Wand [1] do the same, but they stop right before the character. [dldelete), followed, by any motion deletes the text between the cursor and that motion’s destination [iJ], Hichange) does the same, but leaves you in insert mode. ‘Some motions, such as[]] and [J] are linewise - deletion includes the full start/end lines. [repeats the last editing action: text input, delete or change, ete. Prepend a count to any command/motion to repeat it that number ‘oftimes: Hz [iilto delete up to the second word. HMlz]e] > |to delete up to but not including the second comma. “2[i | repeats the text after you press (Esc) to finish the input session. or MIM) to operate on the current line. Only in vim, ]enters visual mode. Move around with motions, the be highlighted. Press an operator to operate on that selection. enters visual-tines mode — like [¥], but selecting whole li Repeat operator ( CTRL-Z] selects rectangular blocks. For the rest of the tutorial & a full cheat sheet, go to www.viemmu.com - home of ViEmu, vi/vim emulation for Microsoft Visual Studio mal | [tpi _| Extras followed by any motion to ‘yank’ (copy), Jand an [B]-[z] character before any yank/delete/paste command an oe. einewi chooses a register. to paste alter (fcharwise tothe right, fnew, below). ar sen ‘An [A]- Z] register before yank/delete means “append-copy”. to paste before ss BZ IB copies the current ine [Jor[*[]select the system clipboard [also works in visual mode. ‘Text deleted with HI], ZL... is also copied! 'Glenters insert mode in a new empty line below the eurrent on ‘Dj dves the same above the current line. For the rest of the tutorial & a full cheat sheet, go to www.viemuu.com - home of ViEmu, vi/vim emulation for Mierosoft Visual Studio Spal os vi/vim lesson 4 - searching [ents] eget ne input Basics: Extras: [lis the basic search motion ~ type the text you are searching for | ‘The following very useful motions work only in vim: fter the slash, and then press return. Being a motion, you can use | [searches forward for the next instance of the identifier under this after an operator, or in visual mode. the cursor IB] does the same, backwards, [Baoes the same backwards. In] repeats the last search inthe same direction, I] repeat Hleneverse direction Be careful, because the search target is interpreted as a regular ‘expression: a°b means one or more ‘a's followed by ab’, “abe means ‘abe’ at the beginning of a line, [o-o] looks for the next digit, et For the rest of the tutorial & a full cheat sheet, go to www.viemuu.com - home of ViEmu, vi/vim emulation for Mierosoft Visual Studio pbs vi/vim lesson 5 - marks & macros act icoocaetee (Cos esis tropa zl i ‘Macros: mal Use [qlfollowed by an [a] -[z] character to start recording, ise [afterwards to stop recording, [@ltollowed by a character replays that macro. [Gla to repeat the last macro played. Marks: Use Hi followed by an i] -[Z]eharacter to set a mark. followed by a character to go to that mark Use lil and a character to go to the first non-blank in that line. [Bl refers to the position of the last modification. For the rest of the tutorial & a full cheat sheet, go to www.viemuu.com - home of ViEmu, vi/vim emulation for Mierosoft Visual Studio irae Cae ae pee =o ona Ana i [39] jumps between matching pairs of (4), ‘[, Tete. [lana DB] jump to the beginning/end of the current sentence. [HMI JL] jump directly to the top/middle/bottom of the screen. Eland Bl jump to the previous/next empty line. 1G) jumps to the end of the file, or to the line # typed before it. ED jumps to the previous {' in column o. E/E jump to the previous/next line. LIED jumps to the next’ in column 0. not technically a motion, jumps to the help for the word under ‘the cursor: vim help, man page under unix, ete. For the rest of the tutorial & a full cheat sheet, go to www.viemuu.com - home of ViEmu, vi/ emulation for Microsoft Visual Studio vi/vim lesson various commands fel | [joins the current line with the next one, or all the lines in the current visual selection, LE] followed by any character replaces the current character with that one. [Wiis shorthand for[Z][B], changes to end of line. [DJis shorthand for UI], deletes to end of line. [Wis shorthand for i] J, yanks the whole Tine, Bldeletes the character under the cursor and enters insert mode. [S| clears the current ine and enters insert mode. motion to indent one or more lines. Janda motion to unindent. land a motion to reformat a range of text. All of them work in visual mode, or can be repeated ( to operate on the currentline. Bete...) [El toggles the case of the character under the cursor. Now go grab the full cheat sheet and learn the rest Start with [I]/a| Eland [#]. Piece of cake! For the rest of the tutorial & a full cheat sheet, go to www.viemmu.com home of ViEmu, vi/vim emulation for Mierosoft Visual Studio

You might also like