Command(s) |
Description |
o and O |
insert new line below and above respectively. |
dd |
delete current line |
x |
delete highlighted character |
shift+x |
delete character to left |
dw |
delete a word |
de |
delete to end of word |
/ |
to search, then n or N to go forward and back in results |
:sp filename |
edit filename in split screen |
ctrl+w+q |
kill splitted screen |
cmd+k and cmd+j |
move line up and down |
ctrl+y and ctrl+e |
move up and down one step without moving cursor |
ce |
change word. similar to cmd+d in sublime c$ to change to end of line |
r |
replace letter under the cursor. |
% |
match parens eg () and {} |
0 and $ |
move to begin and end of line |
4. To change every occurrence of a character string between two lines,
type :s/old/new/g to replace old with new on current line
type :#,#s/old/new/g where #,# are the line numbers of the range
of lines where the substitution is to be done.
Type :%s/old/new/g to change every occurrence in the whole file.
Type :%s/old/new/gc to find every occurrence in the whole file,
with a prompt whether to substitute or not.