Some of these commands and shortcuts are based off my own .vimrc file, so it may not work for your setup when you try performing some of the below commands.
:Gblame
:Ag count app/controllers
:%s/word/love/gc
:Ag #navigation-wrapper app/assets/stylesheets
space + n
space + t
q w
(then do the commands you'd like repeated)q
again to stop recording@w
(to initiate most recent macro)99 @w
(repeats said action 99 times)g + U
to upper case all letters in the wordg + u
to lower case all letters in the wordg + U + r
g + u + r
shift + g
j
number + j
w
b
W
B
$
0
shift + h
shift + l
5w
5l
5h
fy
(case sensitive).
u
ctrl + r
i
I
shift + a
yy
or Y
p
5cw
A
f + char
d<leftArrow>
will delete current and left characterd$
will delete from current position to end of lined^
will delete from current backward to first non-white-space characterd0
will delete from current backward to beginning of linedw
deletes current to end of current word (including trailing space)db
deletes current to beginning of current worddd
shift + j
cw
shift + C
d + number of lines + enter
d<line number>G
:g/< search term>/d
:g/^\s*$/d
c + i + W
d + i + w
c + i + '
. Will delete everything within two single quotes.V
v
control + v
gv
ggVG
v + i + W
:w
:wq
:q!
space + w
with dotfiles:sp filename
:vsp filename
control + w + j
control + w + l
control + w + j
control + w + h
f + <queried item>
/word + enter
n
N
ggn
GN
:noh
:e filename
- Edit a file in a new buffer:bnext
(or :bn
) - go to next buffer:bprev
(of :bp
) - go to previous buffer:bd
- delete a buffer (close a file):sp filename
- Open a file in a new buffer and split windowctrl + ws
- Split windowsctrl + ww
- switch between windowsctrl + wq
- Quit a windowctrl + wv
- Split windows verticallyset paste
in .vimrc filevisual mode + >
or <
shift + <<
shift + >>
CTRL-V
then I#
(insert # in the begining)CTRL-V
then X
(delete the first symbol on the line)gc
control + v
then select lines then I + #
then hit esc
control + v + shift + i + action + esc
v + / + content
:set nu
:syntax on
cd
mv .vimrc .vimrc-old
mv .vim .vim-old
touch .vimrc; mkdir .vim
:h <topic>
:bd
c + i + t
will remove the code between HTML tags, such as: <div>Some content</div>
c + i + }
will remove the code inside of a JavaScript functionClone Github dotfiles.
ciw # cut and paste word
csw X # surround with with ( " ' or anything desired character
dt shift+$ # delete to end of line
:reg
" + 6 + y
" + 6 + p
" + + y
Paste from system buffer: " + + p
Blog photo credit from http://www.nathael.org/Data/vi-vim-cheat-sheet.svg