0% found this document useful (0 votes)
48 views

VI Vim Tutorial

Uploaded by

Georges Landa
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
48 views

VI Vim Tutorial

Uploaded by

Georges Landa
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 7
Apri 6 06 vi/vim lesson 1 - basic editing [ree rs esi | elves I |DEDD are vi/vim cursor keys ~ use them as they are mut closer than regular cursor keys! Use[ii]to enter insert mode, cursor turns from a block into a vertical line, and you can type in text. Use [Ese] to return to normal mode. ‘Use x]to delete the current character, or to delete the one to theleft Use [to go insert text at the end of the line (wherever you are in the line!) (ote: nsort mode is actually very similar to a regular eto, you can use cursor/navigation keys, backspace, delete) For the rest of the tutorial & a full cheat sheet, go to www.viemu.com - home of Vi Extras: [Blto undo the last action — traditional vi has a single level, while vim ‘supports unlimited undo (CTRL -[B|to redo) [Dijumps directly to the beginning of te Hine, [to the end, tothe first non-blank ‘Use fi) [B]EE] to move along ‘words’. A‘word’ is a sequence of all, alphanumeric or punetuation signs: Eagla Use {]EB)EE) to move along WORDS. A'WORD' is a sequence of any non-blank characters: fguux(feo,) Baz,) baz) j] ‘Use [Ri] to enter insert mode with an overstrike cursor, which types over existing characters. [EIDE] and press enter te save,[Z[@]and enter to qu mu, vi/vim emulation for Microsoft Visual Studio Apne 06 aa em (Gea erste Spoetoe lash =| [lems Basies: TB followed by anothor key, moves the cursor to the next instance ‘of that character on the current line, IB] does the same backwards. Band [do the same, but they stop right before the character. [dlcdetete), followed, by any motion deletes the text between the at motion’s destination fi LBL. [Bl change) does the same, but leaves you in insert mode. ‘Some motions, such as{if] and [Il] , are linewise ~ deletion includes the full start/end lines. (Dlrepeats the last editing action: text input, delete or change, ete... ‘motion is recalculated at the new place. For the rest of the tutorial & a full cheat sheet, go to www.viemu.com - home of Vi -ount to any command/motion to repeat it that number I }to delete up to but not including the second comma. TE) repeats the text after you press (Ese) to finish the input session, Repeat operator (IEE or lll) to operate on the current Hine. Only in vim, [¥/ enters visual mode. Move around with motions, the text will be highlighted. Press an operator to operate on that selection. Wenters visual-lines mode — like [¥], but selecting whole lines. CTRL-[¥] selects rectangular blocks, zm, vi/vim emulation for Microsoft Visual Studio Apne 06 = Basics Use If] followed by any motion to yank’ (eapy). Use[B] to paste after (if charwise, to the right, Use[E] to paste before copies the current line [il also works in visual mode. ext deleted with i], IB)... is also copied! Extras [PJ and an 2] -[z] character hefore any yank/delete/paste command chooses a register. An [A]-[Z] register before yank/delete means “append-copy”. (HLzlor{4[e]elect the system clipboard Denters insert mode in a new empty line below the eurrent one. (B) does the same above the curr: 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 itle vi/vim lesson 4 - searching [a als Basics: Extras: [Bis the basic search motion ~ type the text you are searching for The following very useful motions work only after the slash, and then press return. Being a motion, you can use | [searches forward for the next instance of the ident this after an operator, or in visual mode. the sued [does the same, backwards. [Bldoes the same backwards. [iil repeats the last seareh in the same direction, [NJ repeats it in. the reverse direction Be careful, because the search target is interpreted as a regular expression: a*b means one or more a's followed by a°b', “abe ‘means ‘abe’ at the beginning ofa line, [0-0] looks for the next Aigit, ete 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 span 06 '/vim lesson 5 - marks & macros eve the cursor. ar defines eel eel alr [heal Usel lowed by an[a]-[2 Jcharacter to set a mark, Use[El followed by a character to go to that mark Use[HJ and a character to go to the first non-blank in that line. (A)-Z) marks are global, (al - Z]per buffer. |[2] refers to the position of the last modification, For the rest of the tutorial & a full che Macros Use [followed by an [a] -[z] eh {lfollowed by a character replays that macro. B® wo repeat the last macro played. sheet, go to www.viemu.com - home of ViEmu, vi/vim emulation for Microsoft Vis aes oS vi/vim lesson 6 — various motions Ga Pea ia = [and Bl jump to the beginning/end of the current sentence. ‘Mand [fj jump to the previous/next empty line, [Bd] jumps between matching pairs of [HUME] jump direetly to the top/mi [Gl jumps to the end of the file, or to the line 4 typed hefore it. AEIE jumps to the previous "in column 0. TMT jumps to the next '{' in column 0. For the rest of the tutorial & a full cheat sheet, go to www.viemu.com - home of ViEmu, vi/vim emulation for Microsoft Vis Aprils 06 es the current line with the next one, or all the Hines in the ‘carrent visual selection. followed by any character replaces the current character with ; ny any r (Wis shorthand for[=)) [Djis shorthand for{al| [lis shorthand for Bl changes to end ofline. deletes to end of line. yanks the whole line. Blacletes the character under the cursor and enters insert mode. (Bl clears the current line and enters insert mode. Extras [Bi and « motion to indent one or more [Band a motion to unindent. Band a motion to reformat a range of text. All of them work in visual mode, or can be repeated (BEB, cte...) to operate on the current line. [toggles the case of the character under the cursor. Now go grab the full cheat sheet and learn the rest. a Band LB. Piece of eake! 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

You might also like