Enter Text | ||
i | Insert text left of cursor | |
a | Append text right of cursor | |
Editing Text | ||
x | Delete selected character | |
nx | Delete n characters from selected characters | |
X | Delete all character before cursor | |
dw | Delete word | |
ndw (eg 3dw) | Delete n words | |
dd | Delete line | |
ndd | Delete n lines | |
D | Delete characters from cursor to end of line | |
r | Replace character under cursor | |
cw | Replace a word | |
ncw | Replace n words | |
C | Change text from cursor to end of line | |
o | Insert blank line below cursor (ready for insertion) | |
O | Insert blank line above cursor (ready for insertion) | |
J | Join succeeding line to current cursor line | |
nJ | Join n succeeding lines to current cursor line | |
u | Undo last change | |
U | Restore current line | |
Navigating Text | ||
H | Move left one space | |
j | Move down one line | |
k | Move up one line | |
l | Move right one space | |
w | Forward word by word | |
b | Backward word by word | |
$ | Moveto end of line | |
0 (zero) | Move to beginning of line | |
H | Move to top line of screen | |
M | Move to middle line of screen | |
L | Move to last line of screen | |
G | Move to last line of file | |
1G | Move to first line of file | |
<Control>f | Scroll forward one screen | |
<Control>b | Scroll backward one screen | |
<Control>d | Scroll down one-half screen | |
<Control>u | Scroll up one-half screen | |
n | Repeat last search in same direction | |
N | Repeat last search in opposite direction | |
Save and Close File | ||
ZZ | Save file and then quit | |
:w | Save file | |
:q! | Discard changes and quit file | |
Search & Replace | ||
/i | Search for a pattern which will you take you to the next occurrence of it. | |
?i | Search for a pattern which will you take you to the previous occurrence of it. | |
* | Go to the next occurrence of the current word under the cursor. | |
# | Go to the previous occurrence of the current word under the cursor. | |
% | Go to the matching braces, or parenthesis inside code. | |
:s/searchStr/newStr/g | Search and replace all occurrences of searchStr in a line | |
:s/searchStr/newStr/gi | Search and replace all occurrences of searchStr in a line (case insensative) | |
:%s/searchStr/newStr/g | Search all lines and replace all occurrences of searchStr in a line with newStr | |
:%s/searchStr/newStr/gc | Search and replace all occurrences of searchStr in all lines interactively. It will highlight the search string and ask you to replace it or move to next search string |
As usual, thanks for reading! Please put your comments to share your views and feedback.
- InstantKick Team
- InstantKick Team
Emoticon Emoticon