Move Commands

You might also like

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 2

Vi is a powerful text editing tool that can be used quickly and efficiently to alter files, scripts, etc.

Below are some useful cheat sheet commands for vi to speed up text editing:

Move commands
$ 0 G 1G h l k j w W b B H M L CTRL+f CTRL+b CTRL+d CTRL+u cw r R C cc
move move move move move move move move move move move move move move move move move move move to end of line to beginning of line to last line of file to first line of file cursor left cursor right cursor up cursor down to next word to next blank delimited word to beginning of the word to beginning of blank delimited word to top of the screen to middle of the screen to bottom of the screen screen down one page screen up one page screen down 1/2 a page screen up 1/2 a page word letter until [esc] is pressed to the end of the line the entire line

Replace text commands


change replace replace change change

Insert text commands


i - insert before cursor I - insert before line a - append before cursor A - append before line O - insert line above current line o - insert line below current line yy - yank line y$ - yank from current position to end of line p - put yanked text after cursor P - put yanked text before cursor [shift] + [insert] - insert text saved in clipboard

Delete text commands


dd x X D :qw :w :q!
delete delete delete delete entire line character to the right of the cursor character to the left of the cursor to the end of the line

File commands
- quit and save - save - quit without saving

Search Commands
/string ?string n N ~ J . u U
Search Search Search Search forward for string backward for string for next instance of string for previous instance of string

other commands
- toggle between upper and lower case - join lines - repeat last text-changing command - undo last change - undo all changes to line

You might also like