If you have the vim-surround plugin installed:
- To replace surrounding symbols
cs"'(will replace surrounding double quotes by single) - To delete surrounding delimiters
ds((Will remove surrounding parentheses)
bis a text object for a bracket so you can do things likedabto delete around parenthesis instead ofda(,dibto delete inside,cibto change inside and so on ...
Imoves to the start of the line and enters insert modeAmoves to the end of the line and enters insert modexdeletes a single charactersdeletes a single character and goe into insert modecis likedbut enters insert mode after it deletes the selection
-
{count} +moves count lines down to the beggining of the line -
{count} -moves count lines up to the beggining of the line -
gdgo to local declaration -
*search forward for word under the cursor -
#search backward for word under the cursor -
fsearchs forward in a line -
Fsearchs backwards in a line -
;move forwards to next search result in the line -
,move backwards to next search result in the line -
:<line number>moves you to a specific line number (same as<line number>G) -
}moves to the next blank line -
{moves to the previous blank line -
Ctrl + umoves half screen up -
Ctrl + dmoves half screen down -
%goes to matching bracket or parenthesis -
To move through the Jumplist (each position to which your cursor jumped):
ctrl-oto move backwardsctrl-ito move forwards
-
To move through Changelist (the position for every change you can undo):
g;to move backwardsg,to move forwards
m{a-zA-Z}sets a custom mark whose exact location can be accessed using `{mark}- Certains marks are special `. jumps to the last change
:windo difftwill show the diff between two windows:e!discards edits since last save and reloads the file]mmoves to the next curly brace
To move between splits:
ctrl-w jmoves to the top splitctrl-w hmoves to the left splitctrl-w kmoves to the bottom splitctrl-w lmoves to the right split
Once you have split your screen, how can you rearrange your splits? It’s easy with ctrl-w:
ctrl-w Jmoves the active to the topctrl-w Hmoves the active split to the leftctrl-w Kmoves the active split to the bottomctrl-w Lmoves the active split to rightctrl-w rrotates splits to the right/downctrl-w Rrotates splits to the left/up
-
gcccomments line using line comment syntax -
gbccomments line using block comment syntax -
gc[count]{motion}line comment the region contained in {motion} -
gb[count]{motion}block comment the region contained in {motion} -
gcoputs you in insert mode in a comment line below -
gcOputs you in insert mode in a comment line above -
gcAputs you in insert mode at the end of the line