/[pattern]
search forward for pattern?[pattern]
search backward for patternn
repeat search forwardN
repeat search backward*
search for word currently under cursorg*
search for word partially under cursor[I
show lines with matching word under cursor%s/background/&-color/g
find and replace background with background-color.&
inserts the matched pattern%s/yolo/swag/gc
find and replace yolo with swag and ask for confirmation.c
asks for confirmation
gg
beginning of fileshift + g
end of file$
end of line^
beggining of the lineg,
to move forwards through the changelist.g;
to move backwards through the changelist.
:w !sudo tee %
:earlier 15m
g- and g+
go backward and forward in time.g,
to move forwards through the changelist.g;
to move backwards through the changelist.
:! [command]
Executes an external command while you're in Vim.:.! [command]
Executes an external command and dump the results into the buffer eg::.! date
(ctrl + w) + =
set all splits to equal width(ctrl + w) + R
move windows up/left(ctrl + w) + r
move windows down/right(ctrl + w) + L
Move the current window to the "far right"(ctrl + w) + H
Move the current window to the "far left"(ctrl + w) + J
Move the current window to the "very bottom"(ctrl + w) + K
Move the current window to the "very top"(ctrl + w) + x
Exchange current window with next one. If there is no next window, exchange with previous
diw
delete the current worddat
delete everything inside html tag, and the tag itselfdi
delete within limiters. Eg:di{
,di[
,di'
,di(
,di<
dd
delete linedt
delete until. Eg:dt"
,dt<space>
df
delete until, and including. Eg:df"
,df<space>
D
delete rest of the line to the right of the cursor
ciw
change current wordcat
change everything inside html tag, and the tag itselfci"
change within limiters. Eg:ci{
,ci[
,ci'
,ci(
,ci<
cc
change current linect
change until. Eg:ct"
,ct<space>
cf
change until, and including. Eg:cf"
,cf<space>
C
change rest of the line to the right of the cursor
yiw
copy current wordyat
copy everything inside html tag, and the tag itselfyi"
yank within limiters. Eg:yi{
,yi[
,yi'
,yi(
,yi<
yy
yank current lineyt
yank until. Eg:yt"
,yt<space>
yf
yank until, and including. Eg:yf"
,yf<space>
Y
yank rest of the line to the right of the cursor
ctrl + v
start visual block, pressj
ork
to select the lines, pressI
(capital i) type text desired, press<ESC>
:%TOhtml
:ls
List opened buffers:bd
close current buffer append!
to force closing buffer after unsaved changes were made:bd[Number]
to close a buffer by number:bw
close and save current buffer:bw[Number]
to close and save a buffer by number
ctrl + x
decrease the number under the cursorctrl + a
increase the number under the cursor
gv
repeat lst visual selection
:set spell spelllang=<lang>
activate spell checkz=
see suggestions for the selected word
cs"'
change the surroudning pairs ie. double quotes to single quotescs'<q>
change surrounding single quotes to html tag<q>
cst"
change a surrounding tag to double quoteds"
delete surrouding pairs, ie double quotesysiw]
surround only the word under the cursor, using[
,{
, etc will add spaces between the word and the surroundingyss)
surround the entire line with parentheses- On visual mode, surround selection
S<p class="important">
s
open selected file in new windowt
open selected file in new tab
<leader>gm
show popup window with the commit for where the cursor is positioned<leader>gm<leader>gm
move the cursor to inside the window- With the cursor inside the window:
d
show the diff for changes in this file in this commitD
show the diff for changes in ALL the files in this commito/O
move between older and recent commit changes in this file historyq
close window
- Go to code navigation
<Leader>gd
Go to definition<Leader>gy
Go to type definition<Leader>gi
Go to implementation<Leader>gr
Go to references
- Navigation:
gf
Jump to definitionctrl + o
Jump back to previous filectrl + i
Jump forward
Run :Explore
or :Sex
(shorthand for split explore) then navigate on the files and press R
to rename and D
to delete