| Input Commands | Deleting Text |
| Command | Meaning | Command | Meaning |
| a | Append text after the cursor | x or dl | Delete character at the cursor |
| A | Append text at the end of the line | X or dh | Delete character to the left of the cursor |
| i | Insert text before the cursor | dw | Delete word (or part of word to left of cursor) |
| I | Insert text at the beginning of the line | #dw | Delete # of words |
| o | Open a new line below the cursor | dd | Delete line containing the cursor |
| O | Open a new line above the cursor | #dd | Delete # of lines |
| Positioning Commands | D or d$ | Delete line to left of cursor (from cursor position to the end of the line) |
| Command | Meaning | dG | Delete to the end of the file |
| h, Left Arrow, or Back Space | Move left one character | d1G | Delete from beginning of file to cursor |
| j or Down Arrow | Move down one line | :#1,#2d | Delete lines #1 through #2 |
| k or Up Arrow | Move up one line | Undoing Repeating and Changing Text |
| l, Right Arrow or Spacebar | Move left (forward) one character | Command | Meaning |
| 0 | Move to beginning of current line | cw | Change word (or part of word) at cursor location to the end of the word |
| $ | Move to end of current line | #cw | Change # number of words |
| w | Move forward one word (including punctuation) | c#b | Change backwards # of words |
| W | Move forward one word (past punctuation) | cc or S | Replace entire current line |
| b | Move back one word (including punctuation) | C or c$ | Change from cursor to end of line |
| B | Move back one word (past punctuation) | c0 | Change from cursor to beginning of line |
| e | Move to end of current word | s | Substitute string for character(s) |
| E | Move to end of word (past punctuation) | R | Overwrite or replace characters on line |
| ( | Move to beginning of sentence | r | Replace character at cursor with one other character |
| ) | Move to end of sentence | i (Return) | Break line |
| { | Move to beginning of paragraph | J | Join current line and line below |
| } | Move to end of paragraph | xp | Transpose character at cursor and character to the left |
| ]] | Move to next section/function | ~ | Change case of letter at cursor |
| [[ | Move to previous section/function | u | Undo previous command (only goes back one level.) |
| % | Find matching ( ) or { } | U | Undo all changes to current line |
| - | Move up to beginning of previous line | :u | Undo previous last-line command |
| Return | Move down to beginning of next line | Copying and Pasting Text |
| H | Move to top of screen | Command | Meaning |
| M | Move to middle of screen | yy or Y | Yank a copy of line |
| L | Move to bottom of screen | p | Put yanked or deleted line below current line |
| G | Go to last line of file | P | Put yanked or deleted line above current line |
| #G | Go to # line of file | :#1,#2 co #3 | Copy lines #1 through #2 and put after line #3 |
| :# | Go to line # | :#1,#2 m #3 | Move lines #1 through #2 to line #3 |
| CTRL-f | Page forward one screen | Saving and Quitting |
| CTRL-d | Scroll down one-half screen | Command | Meaning |
| CTRL-b | Page back one screen | :w | Save changes |
| CTRL-u | Scroll up one-half screen | :w new_filename | Write buffer to new filename |
| CTRL-E | Scroll window down one line | :wq or ZZ | Save changes and quit vi |
| CTRL-Y | Scroll window up one line | :q! | Quit without saving changes. ('!' bang forces the system to perform action) |
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home