gg
|
Jump to beginning of doc
|
G
|
Jump to end of doc
|
/
|
Search for string
|
n
|
Jump to next instance of string you searched for
|
N
|
Jump to previous instance of string you searched for
|
:q!
|
Let me out, I goofed! This is the "abort my edits" command.
|
:w
|
Save my changes
|
:wq
|
Save and exit
|
u
|
Undo
|
CTRL+r
|
Redo (redo an undo)
|
i or I
|
Insert before cursor or Insert at beginning of line
|
a or A
|
Append after cursor or Append at end of line
|
o or O
|
Open a new line below or above the cursor
|
yy
|
Yank (copy) this line
|
p or P
|
paste below or above. can also be paste before or after depending on what was yanked.
|
dd or D
|
Delete this line or Delete to end of line
|
2yy
|
Yank (copy) 2 lines
|
10p
|
paste 10 times
|
r or R
|
replace 1 character or enter replace mode
|
|
|
|
|
|
|
|
|
|
|
v
|
Visual (highlighting) Mode, selects a character at a time
|
V
|
Visual (highlighting) Mode, selects a line at a time
|
CTRL+v
|
Visual (highlighting) Mode, selects a rectangular block
|
V =
|
Will attempt to auto-indent the highlighted section based on rules for the detected type of document
|
gg=G or G=gg
|
Auto indent the entire document
|
V >
|
Indent the highlighted line(s) 1 time
|
V <
|
Remove 1 indent from the highlighted line(s)
|
V 5>
|
Indent the highlighted line(s) 5 times
|
?
|
Reverse search (opposite of /)
|
i CTRL+t
|
CTRL+t in insert mode will insert a tab at the front of this line (cursor does not have to be positioned at the front of this line)
|
V :s/.*/<li>&<\/li>/
|
This demonstrates running a substitute command against a range of lines without having to specify their line numbers. Merely highlight the appropriate lines with V (Visual Mode), then start the :s/// (substitute command). You will notice that you automatically get extra junk on the command line which looks like this :'<,'> don't delete it, just add your s/// to the end of it. This particular s/// command adds list item tags (<li> and </li>) to the range specified.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
:nohls
|
stop the current highlighting (maybe from a search or a match) / you could also search for something that doesn't exist
|
s or S
|
delete 1 character and enter insert mode or delete this line and enter insert mode. Also works with visual mode.
|