vib
- Select everything inside parenthesis
vab
- Select everything inside parenthesis (including parenthesis)
vi"
- Select everything inside double/single quotes
viB
vi{
- Select curly brace block
gv
- Select last visual block
VISUALo
- Move cursor to other end of the selection
%
- Jump to matching brace
{
}
- Move to next/previous paragraph
mq
- Add mark q at cursor position
'q
- Jump to mark q
;
- Repeat last f, t, F or T search
zz
- Center on cursor
H M L
- Jump to top/middle/button of the screen
Ctrl+U/D - Scroll half a page up/down
~
- Change case
VISUALU
- Change to upper case
VISUALu
- Change to lower case
==
- Fix line indent
>aB
- Indent block
Ctrl+A/X - Increment/decrement number under cursor
R
- Start overriding text under cursor
di(
- Delete everyting inside parenthesis
"ayy
- Copy (yank) line to register a
"Ayy
- Append line to current content of register a
"ap
- Paste content from register a
:s/foo/bar/g
- Search 'foo' and replace with 'bar' anywhere in current line
:%s/foo/bar/g
- Same as above but anywhere in current file
:%s/\%Vfoo/bar/g
- Replace 'foo' with 'bar' in visual block only
\( \)
- Grouping
\1 \2 ...
- first, second, ... matched pattern
.
- Matches any character (except newline)
* \+ \{n} \{n,m}
- Matches 0 or more, 1 or more, exactly n times, from n to m characters
\_s
- Matches whitespace or newline character
:s/x/\r/g
- Replace every occurence of 'x' with a newline
\(foo\|bar\)
- Matches either 'foo' or 'bar'
See vimregex
:w !sudo tee %
- Save current buffer with sudo rights
:noh
- Clear search highlight
:r !ls
- Insert output of ls
at current cursor position
Ctrl+R "
- Paste last yanked text (also works in command-line mode)
Ctrl+Q - Makes VIM responsive again if it hangs after Ctrl+S