vimtricks
vimtricks copied to clipboard
Vim commands (magic) I'm used to show other people to demonstrate how cool vim is.
Vim Magic
gg=GIndent all rows==Indent current rowzzCurrent line to centerztCurrent line to topzbCurrent line to bottomZZSave and quitciwChange wordci"Change everything inside double quotes (Works with other characters)gdGo to definitionggGo to start of the documentGGo to end of the documentJJoin linesgJJoin lines without inserting space%Jump to corresponding item ((),{},[]).Repeat previous command*Search for next occurance under cursor#Search for previous occurance under cursor%Move cursor to the first character of line$Move cursor to the last character of linegiGo insert mode where you were last insert modeDDelete the rest of the lineddDelete linezoOpen foldzcClose foldzzMove cursor to center of screenztMove cursor to top of screenzbMove cursor to bottom of screen:jumpsJump listCtrl-o- Jump tobackwards element in jump list Ctrl-i- Jump toforwards element in jump list {Move to start of previous paragraph or code block.}Move to end of next paragraph or code block.Ctrl+FMove forward one screenful.Ctrl+BMove backward one screenful.~Toggle case under cursoroEdit in a new line below the currentOEdit in a new line above the current:r[name] Insert the file [name] below the cursor.~Switch case of the character under the cursor and move the cursor to the right. If a [count] is given, do that many characters.DDelete until end of linedGDelete until end of fileRGo to overwriting mode (edit mode but doesn't insert text but overwrites)
Search:
-
/ search
-
? search
-
giinsert mode where insert mode was exited last time -
gJlines without space -
gaASCII code of the character under cursor -
gfediting the file under the cursor -
[IShow lines with matching word under cursor -
:grep Vim *.mdand after:copento open grep result in quickfix
Moving until search term
y/search<Enter>y?search<Enter>d/search<Enter>d?search<Enter>c/search<Enter>c?search<Enter>
Other
!sortsort visually selected lines
.vimrc
inoremap jj <Esc>