+*Must be in Command Mode to perform the following commands.
General
Press ESC to exit Insert Mode
Press ESC to exit Insert Mode
Press ESC to exit Replace Mode
*NOTE: Pressing Insert twice also
enters replace mode
Press ESC to exit Visual Mode
If the are in another mode, ESC will
take you into Command Mode
Ex) 2dd - Deletes 2 lines
Delete everything until
end of file
Press gg or 1G before you do this
command to delete everything from
beginning to end
Ex) 3yy - Copies 3 lines
Always pastes below the green cursor
Jumps to matching
bracket
To access the % symbol, press Shift +
5
Ex) 4u - undoes the last 4 changes
Press n to increment search
Searches all instances
of [search] and
replaces them with
[replace]
Ex) :%s/Hello/World/g - Searches
for all instances of “Hello” and replaces
it with “World”
:[x],[y]s/[search]/[replace]/g
Change each
[search] to
[replace] from line
[x] to line [y]
Ex) :5,12s/Hello/World/g - Same
as above, but only replaces from line 5
to line 12 (inclusive)
The “G” must
be capitalized
# = (Optional) Any number can precede the command
This workforce product was funded by a grant awarded by the U.S. Department of Labor’s
Employment and Training Administration. The product was created by the grantee and
does not necessarily reflect the official position of the U.S. Department of Labor. The U.S.
Department of Labor makes no guarantees, warranties, or assurances of any kind, express
or implied, with respect to such information, including any information on linked sites and
including, but not limited to accuracy of the information or its completeness, timeliness,
usefulness, adequacy, continued availability, or ownership.