Skip to content

Instantly share code, notes, and snippets.

@IbanMM
Last active June 6, 2020 09:44
Show Gist options
  • Save IbanMM/c5fb365df7f001495e91b51f898b7403 to your computer and use it in GitHub Desktop.
Save IbanMM/c5fb365df7f001495e91b51f898b7403 to your computer and use it in GitHub Desktop.
# Selection
yw - Copy word
yy - Copy current line
y$ - Copy from cursor to the end of the line
yG - Copy from cursor to the end of the file
dit - Remove all inside a html tag
yi" - Copy every thing inside quotes
# Navigation
G - Go to the end of the document
gg - Go to the start of the document
23gg - Go to line 23
_ - Go to the first non blank character of the line
0 - Go to the start of the line
$ - Go to the end of the line
f - Go to the next matching character
F - Go to the previous matching character
; - Repeat
# Indentation
g=GG - Reindent the entire buffer
>> - Indent line by shiftwidth spaces
<< - De-indent line by shiftwidth spaces
5>> - Indent 5 lines
5== - Re-indent 5 lines
>% - Increase indent of a braced or bracketed block (place cursor on brace first)
=% - Reindent a braced or bracketed block (cursor on brace)
<% - Decrease indent of a braced or bracketed block (cursor on brace)
]p - Paste text, aligning indentation with surroundings
=i{ - Re-indent the 'inner block', i.e. the contents of the block
=a{ - Re-indent 'a block', i.e. block and containing braces
=2a{ - Re-indent '2 blocks', i.e. this block and containing block
>i{ - Increase inner block indent
<i{ - Decrease inner block indent
# Other shit
u - Undo
~ - Switch case
Alt+o - New empty line below
:w !sudo tee % - Save as sudo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment