Skip to content

Instantly share code, notes, and snippets.

@pstachula-dev
Last active August 29, 2015 13:56
Show Gist options
  • Save pstachula-dev/8974789 to your computer and use it in GitHub Desktop.
Save pstachula-dev/8974789 to your computer and use it in GitHub Desktop.
Vim cheat sheets
1. Useful Commands
gg - jump to begining of file
G - jumo to end of file
{ - jump to paragraph
i - insert mode
a - insert mode after cursor
o - insert in new line below and swtich to insert mode
O - insert in new line above and swtich to insert mode
r - change letter
x - delele character
s - delete charcter and switch to insert mode
w - select first letter of next word
b - select previous word
cw - delete word and switch to insert mode
dw - delete word
dd - delete line
cc - delete line and insert mode
>G - indentation from the current line
. - repeat last change
u - undo changes
<C-r> - redo changes
A - move cursor to the end of line and switch to insert mode
I - move cursor to the start of line and swotch to insert mode
C - delete to the end of line and insert switch to insert mode
f{char} - look for the next character and move cursor to this match
; - select next match
, - select previous match
/pattern- n/N select next/previous match
%s/word/newowrd/g - search and replace word
2. Normal mode
yyp - duplicate line
>> - indent line
p - paste
yw - copy word
<C-d> - move down of half a screen
<C-u> - move up...
zz - move cursor in middle in the window
<C-ww> - change tab
vsplit{name} - new tab
<C-w>HJKL - moving tab
<C-w>> - expand a tab
<C-w>= - default size
:tabe {path}-new tab
3. Insert mode
<C-h> - delete back one character
<C-w> - delete back one word
<C-u> - delete back to start of line
4. Visual mode
v - visual mode
V - line visual mode
<C-v> - block visual mode (helper $)
vit - select word inside tag
ct{char}- delete word inside tag and swich to insert mode
gv - reselect visual selection
r{char} - replace character
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment