Move in screen: L
low, M
middle, H
high
{
and }
jump by paragraph
t<char>
— Move forward until the next occurrence of the character.
f<char>
— Move forward over the next occurrence of the character.
T<char>
— Move backward until the previous occurrence of the character.
F<char>
— Move backward over the previous occurrence of the character.
ctrl-v
- visual block mode
xp
to change the order of two characters.
ddp
to change the order of two lines. (mnemonic Diddy-P LOL)
*
- search for the word under cursor, then n/p
to jump to next/previous.
:bd
- buffer delete; close file without closing Vim window
Ctrl-A
/ Ctrl-X
- increment/decrement number under cursor. Use with # to add
Map a key command to save and run a file:
:map ,r :w\|:!ruby foo.rb<cr>
Convert spaces to tabs:
:set expandtab
:retab
~
- toggle case
:tildeop
will make ~
act as an operator such as d
or c
, so that you can type ~4w
to invert the case of the next 4 words.
gu
+ motion – Change text to lower case
gU
+ motion – Change text to upper case
ciw
("change inner word") change word under cursor
ci"
change double-quoted string (but keep the quotes)
ci(
change text between matching parentheses, also works with brackets
cc
change whole line
ct_
- change to underscore, etc.
"ayy
- yank to named buffer a
"ap
- paste buffer a
ma
- mark position a
'a
- move cursor to line containing a
```a`` - move cursor to the character marked by a
Study up on `y' commands: good article