Here is a list of vim commands that I regularly use. Many of them are customised.
{
move to previous paragraph}
move to next paragraph#
search for previous occurrence of the word under cursor$
go to the end of the line%
move to matching character (default supported pairs: '()', '{}', '[]' - use :h matchpairs in vim for more info)(
move to previous sentence)
move to next sentence*
search for next occurrence of the word under cursor.
repeat last change/pattern/e+1
move to 1 space after the end of the word/pattern
search for pattern0
go to beginning of the line:!<COMMAND>
run a terminal command:%s/old/new/gc
replace all old with new throughout file with confirmation:colors
change colour scheme:e .
open file browser:e
edit file (then enter file address):h
help:noh
disable search highlighting:q!
quit without saving:q
quit:qa
quit all windows at once:tabmove 0
move tab to the beginning:tabmove 1
move current tab to become the 2nd tab:tabmove
move tab to the end:w
save file;
repeat last command<Ctrl><Tab>
go to next buffer (custom)<Ctrl>a
yank all text (custom)<Ctrl>b
page up<Ctrl>c
copy text (custom)<Ctrl>e
move view pane down<Ctrl>f
page down<Ctrl>h
move to the left in insert or command mode (h,j,k,l,w,e,b movements are mapped -- custom)<Ctrl>n
autocomplete (insert mode)<Ctrl>n
select text for multicursors editing (normal mode)<Ctrl>r
redo<Ctrl>s
save files (custom)<Ctrl>v
paste text (custom)<Ctrl>y
move view pane up<F3>
toggle paste mode (custom)<F5>
refresh current tab (custom)<F6>
remove white trailing space (custom)<F7>
open new terminal (custom)<Leader>1
go to buffer #1 (custom, up to 9)<Leader>F
open FZF (custom)<Leader>L
toggle limelight<Leader>as
toggle AutoSave (custom)<Leader>ea
open easy-align (custom)<Leader>fXX
move to the next two XX characters you type (custom)<Leader>go
toggle Goyo (custom). Suggestion: Type<Ctrl>w20<
when opening Markdown files<Leader>n
disable search highlighting (custom)<Leader>nf
toggle NERDTreeFind (custom)<Leader>nt
toggle NERDTree (custom)<Leader>rn
toggle relative line numbers (custom)<Leader>sa
sort lines alphabetically, remove duplicates (:'<,'>sort u
) (custom)<Leader>sn
sort numbers (custom)<Leader>sr
sort in reverse (custom)<Leader>t
open vertical terminal REPL (custom)<Leader>w
navigate to word (custom)<Leader>x
close buffer (:bd
) (custom)?pattern
search backward for patternA
append at end of line ($a
)C
delete to the end of the line and open insert mode (c$
)D
delete to the end of the line (d$
)Esc
normal modeFX
find the previous X characterG
go to last lineH
go to the top of the screenI
insert mode in the beginning of the line (0i
)K
move selected lines up in visual mode (custom)J
move selected lines down in visual mode (custom)J
join line below to the current one with one space in betweenL
go to the bottom of the screenM
go to the middle of the screenN
search backwardsO
open new line above and take to insert modeP
paste before cursorR
replace modeSELECTEDTEXT S'
add'
or any other symbol surrounding a text element. From tpope's great surround plugin. It can be combined withtargets.vim
, too. Ex: to add inverted commas to[surround plugin]
above, just typevi[S"
. To change"
to'
, typecs"'
; to delete the surrounding"
, typeds"
S
delete line and move to the beginningTX
puts the cursor just before the character XXXgg
go to the XX line, just type the numberY
yank to the end of the line (custom)`"
go to last cursor positioncMOTION
change to end of word (e
) or any other motion you want to usefX
jump to the next character XgJ
join line below to the current one without space in betweengcMOTION
comment a text selection. It can be a paragraph (gcip
) or any other selectiongcc
comment a linegg
go to the first linegj
go to following displayed linegk
go to previous displayed lineh j k l
move cursor ( h: ← j: ↓ k: ↑ l: → )i
writing moden
repeat searcho
open new line below and take to insert modep
paste after cursorr
replace a single characterset COMMAND!
unset a commandtX
place the cursor in the character that comes beforeX
u
undov
visual mode (use to select text)x
delete character under cursory
yank (copy)yy
yank lineyyp
duplicate linezR
unfold the whole documentza
open/close foldzb
moves the current line to the bottom of the screenzt
moves the current line to the top of the screenzx
refresh foldszz
moves the current line to the middle of the screen~
switch caseˆ
jump to the first non-blank character of the line
<Leader>cc
open:CocCommand
(custom)<Leader>cl
open coc-lists (custom)<Leader>cm
open coc-marketplace (custom)
<Leader>t
open new terminal (custom)<F7>
open new terminal (custom)<F8>
open new R terminal (custom)<F9>
open new python terminal (custom)<F10>
go to next terminal (custom)<F11>
toggle terminal (custom)<F12>
close terminal (custom)<Leader>l
send code to terminal (custom)
<Leader>gi
create private gist with description (custom)<Leader>gI
create public gist with description<Leader>ge
edit gist with description (custom)<Leader>gx
delete gist
<Leader>ga
git add (custom)<Leader>gb
showsgit blame
output (custom)<Leader>gbr
git branch (custom)<Leader>gc
git commit. Write a comment and close the tab to push (custom)<Leader>gca
git amend (custom)<Leader>gcam
git amend --no-edit (custom)<Leader>gco
git checkout (custom)<Leader>gd
git remove (custom)<Leader>gf
git fetch (custom)<Leader>gl
git log (custom)<Leader>gm
git merge (custom)<Leader>gpb
git pull --rebase (custom)<Leader>gpl
git pull (custom)<Leader>gps
git push (custom)<Leader>gr
git read (custom)<Leader>gs
git status (custom)<Leader>gv
git diff, vertical split (custom)
<Ctrl-]>
dismiss the current suggestion<fn-option-]>
cycle to the next suggestion, if one is available<fn-option-[>
cycle to the previous suggestion<fn-option-\>
explicitly request a suggestion, even if Copilot is disabled
<Leader>ll
build a pdf with latexmk<Leader>lv
view pdf<Leader>lc
clean auxiliary files<Leader>lt
open table of contents
mX
toggle markX
(0-9, a-z) to textdmX
delete markX
m,
toggle next available markm-
delete all marks from current linem<Space>
delete all marks'X
jump to markX
]'
jump to next line containing a mark['
jump to previous line containing a mark]`
jump to next mark[`
jump to previous markm/
show all marks
]]
go to next header[[
go to previous header][
go to next sibling header[]
go to previous sibling header]c
go to current header]u
go to parent header
:Pandoc --ascii
display diacritics in html output
==
indent line=
indent selectiongg=G
indent whole buffer<Leader>ae
send file<Leader>ca
send chunk<Leader>d
run a line and goes down<Leader>fa
run a function and go down<Leader>gn
go to next R chunk<Leader>gN
go to previous R chunk<Leader>kh
builds html<Leader>kl
builds beamer pdf<Leader>kp
build pdf with Knitr<Leader>kr
renders markdown file<Leader>pa
run a paragraph and go down<Leader>rf
opens a new R session<Leader>rh
help<Leader>rl
list space<Leader>rm
remove objects and clear console<Leader>rn
names<Leader>ro
object browser<Leader>rp
print<Leader>rq
quit R session<Leader>rr
clear console<Leader>rs
summary<Leader>rt
structure<Leader>rv
show data in a new tab<Leader>sa
run a selection and go down<Leader>se
runs a selection and show output<Leader>xx
toggle comment
<Ctrl>wXX<
increase width (replaceXX
by any number you prefer)<Ctrl>wXX>
decrease width (replaceXX
by any number you prefer)<Ctrl>w<Ctrl>R
switch windows<Ctrl>wT
send current window to a new tab<Ctrl>wl
move focus to the right window (useh
to move to the right window,j
below,k
above)<Ctrl>wL
move window ( H: ← J: ↓ K: ↑ L: → )<Ctrl>wc
close window<Ctrl>wS
horizontal splitting:sp
horizontal splitting<Ctrl>wv
vertical splitting:vs
vertical splitting<Ctrl>wQ
close window
z=
in normal mode (click over the word first)zG
add new word to dictionary]s
next wrong word[s
previous wrong word<Ctrl>ns
disable spell check (custom)<Leader>z
automatically chooses the first suggested word<Leader>cs
open Thesaurus<Leader>wg
toggle write-good (custom)<Leader>T
translate word (custom)<Leader>wc
toggle vim-grammarous (custom)<Leader>wr
reset vim-grammarous (custom)<Leader>mm
toggle vim-table-mode (custom). Use|
to delimit the first line, then type||
(without leaving insert mode) to write a properly formatted horizontal line. Add as many lines as you want (remember to delimit the columns with|
), then return to the first line and type||
.