Miscellaneous
Case
| Shortcut |
Description |
vU |
Uppercase character |
vu |
Lowercase character |
~ |
Toggle case character |
viw U |
Uppercase word |
viw u |
Lowercase word |
viw ~ |
Toggle case word |
VU / gUU |
Uppercase line |
Vu / guu |
Lowercase line |
V~ / g~~ |
Toggle case line |
gggUG |
Uppercase all text |
ggguG |
Lowercase all text |
ggg~G |
Toggle case all text |
Jumping
| Shortcut |
Description |
<C-o> |
Go back to previous |
<C-i> |
Go forward |
gf |
Go to file in cursor |
ga |
Display hex, ascii value |
Misc command-lines
| - |
- |
:h |
Help open help view |
:edit! |
Reload current file |
:2,8m0 |
Move lines 2-8 to 0 |
:noh |
Clear search highlights |
:sort |
Sort lines |
:ter |
Open a terminal window |
:set paste |
Enable Insert Paste sub-mode |
:set nopaste |
disable Insert Paste sub-mode |
:cq |
Exiting with an error (aborting Git) |
Navigating
| Shortcut |
Description |
% |
Nearest/matching {[()]} |
[( | [{ |
Previous ( or { |
]) | ]{ |
Next ) or } |
[m |
Previous method start |
[M |
Previous method end |
Counters
| Shortcut |
Description |
<C-a> |
Increase number |
<C-x> |
Decrease number |
| Shortcut |
Description |
:tag Classname |
Jump to first definition of Classname |
<C-]> |
Jump to definition |
g] |
See all definitions |
<C-t> |
Go back to last tag |
<C-o> <C-i> |
Back/forward |
:tselect Classname |
Find definitions of Classname |
:tjump Classname |
Find definitions of Classname (auto-select 1st) |
| - |
- |
:ce 8 |
Center lines between 8 columns |
:ri 4 |
Right-align lines at 4 columns |
:le |
Left-align lines |
See :help formatting
Marks
| Shortcut |
Description |
`^ |
Last position of cursor in insert mode |
`. |
Last change in current buffer |
`" |
Last exited current buffer |
`0 |
In last file edited |
'' |
Back to line in current buffer where jumped from |
`` |
Back to position in current buffer where jumped from |
`[ |
To beginning of previously changed or yanked text |
`] |
To end of previously changed or yanked text |
`< |
To beginning of last visual selection |
`> |
To end of last visual selection |
ma |
Mark this cursor position as a |
`a |
Jump to the cursor position a |
'a |
Jump to the beginning of the line with position a |
d'a |
Delete from current line to line of mark a |
d`a |
Delete from current position to position of mark a |
c'a |
Change text from current line to line of a |
y`a |
Yank text from current position to position of a |
:marks |
List all current marks |
:delm a |
Delete mark a |
:delm a-d |
Delete marks a, b, c, d |
:delm abc |
Delete marks a, b, c |
Calculator
| Shortcut |
Description |
<C-r> = 7*7 |
Shows the result |
<C-r> = 10/2 |
Shows the result |
Do this in INSERT mode
Shell
| - |
- |
:!<shell> |
Interpret Shell Command |
:r!<shell> |
Read in output of shell |
:r!date |
Insert date |
:!!date |
Replace current line with date |
Command line
| Shortcut |
Description |
<C-r><C-w> |
Insert current word into the command line |
<C-r>" |
Paste from " register |
<C-x><C-f> |
Auto-completion of path in insert mode |
Tricks
Remove duplicate lines
To number the lines in the file
Copy whole doc to clipboard
:%w !pbcopy # Mac OS X
:%w !xclip -i -sel c # GNU/Linux
:%w !xsel -i -b # GNU/Linux