| h |
move left: one character |
| j |
move down one line |
| k |
move up one line |
| l |
move right one character |
| ^F |
move forward one screen |
| ^B |
move backward one screen |
| ^U |
scroll up half a screen |
| ^D |
scroll down half a screen |
| G |
go to line (the end of the file if no number prefix) |
| //pattern |
find next occurrence of "pattern" |
| ?pattern |
find previous occurrence of "pattern" |
| n |
repeat the last '/' or '?' |
| N |
reverse direction and repeat last '/' or '?' |
| H |
go to top line of screen (home) |
| L |
go to last line of screen |
| M |
go to middle line of screen |
| + or 'return' |
go to the first character of next line |
| - |
go to the first character of previous line |
| 0 |
(zero) go to beginning of current line |
| $ |
go to end of current line |
| ^ |
go to first non-blank character of current line |
| 'number'| |
(as in 3|) go to column number |
| w |
go to next word. If 'W' go to next word surrounded by blanks. |
| b |
go back one word. If 'B' go back to word surrounded by blanks |
| e |
go to end of current word. If 'E' go to end of current word before blank |
| ) |
go to beginning of next sentence |
| ( |
go back a sentence |
| } |
go forward a paragraph |
| { |
go back a paragraph |
| % |
go to matching bracket |
| m['a'..'z'] |
mark current position (for use with the following command) |
| ['a'..'z'] |
go to marked position |
| |
|
Inserting Information
Ways to enter the insert mode: |
| i |
start inserting at the current cursor position |
| I |
start at the beginning of the current line |
| a |
start one after the current position |
| A |
start at the end of the current line |
| o |
open a line below and start inserting |
| O |
open a line above and start inserting |
| |
|
Insert Mode Commands |
| ^H |
deletes the last character |
| ^W |
deletes the last word |
| ^D |
moves back over auto-indentation |
| <Esc> |
(the escape key) returns you to command mode |
| |
|
Editing Commands
In the command mode there are line and character manipulation commands as follows: |
| rx |
replace current character with x |
| R |
replace multiple characters starting at cursor |
| x |
delete current character |
| X |
delete character before current |
| |
|
Text Commands |
| cc |
blank out current line and go into input mode |
| C |
change text from cursor to end of the line |
| dd |
delete current line |
| D |
delete from cursor to the end of the line |
| s |
replace a character with new text |
| S |
same as 'cc' above, but does not blank out current line |
| J |
join next line to the end of the current line |
| >> |
shift lines right |
| << |
shift lines left |
| |
|
Screen Adjusting Commands |
| ^L |
clears and redraws the screen removing all @ lines |
| ^R |
retypes the screen removing all @ lines |
| ^G |
shows the name, current and total number of lines in this file |
| z |
redraws the screen and places the current line at the top of the screen. z- places the current line at the bottom and z. places the current line at the center |
| ^E |
scroll window down one line |
| ^Y |
scroll window up one line |
| |
|