Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

From Vim

Select, then act

In Vim you type the action first and the motion second. In dk you select the text first and then act on the selection. w, b and e select by words, and x selects the lines of each selection. Then d deletes the selection, c deletes it and enters Insert mode, and y yanks it.

Three rows of the table below show what that looks like:

  • Vim’s dd is x d in dk: x selects the line and d deletes it.
  • Vim’s dw is w d in dk: w selects to the start of the next word and d deletes it.
  • Vim’s yy is x y in dk: x selects the line and y yanks it.

Keys

TaskVimdk
move lefthh
move downjj
move upkk
move rightll
go to the start of the next wordww
go to the start of the previous wordbb
go to the end of the next wordee
go to the start of the next long wordWW
go to the start of the previous long wordBB
go to the end of the next long wordEE
go to the start of the line0g h
go to the first character of the line that is not whitespace^g s
go to the end of the line$g l
go to the first lineggg g
go to the last line, or to line N with a countGG
go to the next paragraph}] p
go to the previous paragraph{[ p
go to the bracket that matches the one at the cursor%m m
go to the top of the viewHH
go to the middle of the viewMM
go to the bottom of the viewLL
find the next match of a characterf{char}f
find the character before the next match of a charactert{char}t
find the previous match of a characterF{char}F
find the character after the previous match of a characterT{char}T
repeat the last find;A-.
scroll down one pageCTRL-FC-f
scroll up one pageCTRL-BC-b
scroll down half a pageCTRL-DC-d
scroll up half a pageCTRL-UC-u
scroll the view down one lineCTRL-EC-e
scroll the view up one lineCTRL-YC-y
put the cursor line on the middle row of the viewzzz z
put the cursor line on the first row of the viewztz t
put the cursor line on the last row of the viewzbz b
go back to the jump beforeCTRL-OC-o
go to the next jumpCTRL-IC-i
save the position to go back to laterm{A-Za-z}C-s
delete the selectiond{motion}d
change the selectionc{motion}c
yank the selectiony{motion}y
delete a characterxd
delete a worddww d
change to the end of a wordcwe c
delete a lineddx d
change a lineccx c
yank a lineyyx y
delete to the end of the lineDv g l d
change to the end of the lineCv g l c
yank to the end of the lineYv g l y
delete the word at the cursordiwm i w d
delete the word at the cursor and the white space next to itdawm a w d
change the word at the cursorciwm i w c
yank the word at the cursoryiwm i w y
delete the paragraphdipm i p d
delete the paragraph and the blank lines after itdapm a p d
delete the text in the parenthesesdi(m i ( d
delete the parentheses and the text in themda(m a ( d
paste after the cursorpp
paste before the cursorPP
use a register for the next command"{register}"
yank a line into register a"ayyx " a y
paste register a after the cursor"ap" a p
replace a characterr{char}r
switch the case~~
indent a line>>x >
unindent a line<<x <
join linesJJ
join lines with no spacegJg J
fill the lines to the text widthgq{motion}g q
add a number to the number at the cursorCTRL-AC-a
subtract a number from the number at the cursorCTRL-XC-x
filter the line through a shell command!!{filter}x |
undouu
redoCTRL-RU
go to an older text stateg-g minus
go to a newer text stateg+g +
repeat the last change..
insert before the cursorii
insert after the cursoraa
insert at the first character of the lineII
insert at the end of the lineAA
insert where Insert mode ended the last timegig I
open a line belowoo
open a line aboveOO
start Visual mode, or Select mode in dkvv
select whole linesVx
start blockwise Visual mode, or Block mode in dkCTRL-VC-v
select the whole documentggVG%
select the last selection againgvg v
select the word at the cursorviwm i w
search forward/{pattern}<CR>/
search backward?{pattern}<CR>?
go to the next matchnn
go to the previous matchNN
search forward for the word at the cursor*m i w * n
search backward for the word at the cursor#m i w * N
search forward for the word at the cursor, also inside a longer wordg*m i w g * n
search backward for the word at the cursor, also inside a longer wordg#m i w g * N
go to the next change of a diff]c] g
go to the previous change of a diff[c[ g
go to the definition of the word at the cursorCTRL-]g d
show docs for the word at the cursorKspace k
open the file named at the cursorgfg f
show the code of the character at the cursorg8g 8
split the view: the new view goes belowCTRL-W sC-w s
split the view: the new view goes to the rightCTRL-W vC-w v
focus the next viewCTRL-W wC-w w
focus the view to the leftCTRL-W hC-w h
focus the view belowCTRL-W jC-w j
focus the view aboveCTRL-W kC-w k
focus the view to the rightCTRL-W lC-w l
move the view to the far leftCTRL-W HC-w H
move the view to the bottomCTRL-W JC-w J
move the view to the topCTRL-W KC-w K
move the view to the far rightCTRL-W LC-w L
make the view tallerCTRL-W +C-w +
make the view shorterCTRL-W -C-w minus
make the view widerCTRL-W >C-w >
make the view narrowerCTRL-W <C-w <
make the view as tall as it can beCTRL-W _C-w _
make the view as wide as it can beCTRL-W |C-w |
give the views equal sizesCTRL-W =C-w =
close the viewCTRL-W qC-w q
close every other viewCTRL-W oC-w o
go to the next tab pagegtg t
go to the previous tab pagegTg T
stop the editor and go back to the shellCTRL-ZC-z
write the document and quitZZ:write-quit
quit with no writeZQ:quit!
write the document:w[rite]:write
write each changed document:wa[ll]:write-all
quit:q[uit]:quit
quit every view:qa[ll]:quit-all
write the document and quit:wq:write-quit
write each changed document and quit:wqa[ll]:write-quit-all
open a file:e[dit]:open
open an empty document:ene[w]:open-empty-document
close the document:bd[elete]:close-document
show the next document:bn[ext]:goto-next-document
show the previous document:bp[revious]:goto-previous-document
split the view: the new view goes below:sp[lit]:split-view-below
split the view: the new view goes to the right:vs[plit]:split-view-right
open a file in a new tab page:tabe[dit]:open-tab
close the tab page:tabc[lose]:close-tab
close every other tab page:tabo[nly]:close-other-tabs
go to the next tab page:tabn[ext]:goto-next-tab
go to the previous tab page:tabp[revious]:goto-previous-tab
move the tab page:tabm[ove]:move-tab
set an option:se[t]:set-option
set an option of the document:setl[ocal]:set-document-option
set the theme:colo[rscheme]:set-theme
run a shell command:!:run-shell-command
show the messages:mes[sages]:show-messages
show the working directory:pw[d]:show-directory
show help:h[elp]:help
check the health of the setup:che[ckhealth]:check-health
compare the document in a diff:difft[his]:diff-this
end the diff:diffo[ff]:end-diff
get the change from the other document of the diff:diffg[et]:get-diff-change
put the change into the other document of the diff:diffpu[t]:put-diff-change

Commands, folds, marks and registers

  • : opens the prompt, and many typed commands have a short alias, such as :w, :q, :wq and :e.
  • dk has no folds yet.
  • C-s saves your place on the jumplist, C-o goes back to it, C-i goes forward again, and space j lists the saved places.
  • " and a character pick the register for the next command, so "ay yanks to register a and "ap pastes from it.

Themes

dk ships Vim’s colorschemes as themes named vim_<name>, and Neovim’s default colors as neovim and neovim_light. A colorscheme with a dark and a light variant becomes two themes: vim_<name> from the dark one and vim_<name>_light from the light one. The Vim themes are vim_blue, vim_catppuccin, vim_catppuccin_light, vim_darkblue, vim_delek, vim_desert, vim_elflord, vim_evening, vim_habamax, vim_industry, vim_koehler, vim_lunaperche, vim_lunaperche_light, vim_morning, vim_murphy, vim_novum, vim_novum_light, vim_pablo, vim_peachpuff, vim_quiet, vim_quiet_light, vim_retrobox, vim_retrobox_light, vim_ron, vim_shine, vim_slate, vim_sorbet, vim_torte, vim_unokai, vim_wildcharm, vim_wildcharm_light, vim_zaibatsu and vim_zellner.

To use one, put theme = "vim_habamax" in config.toml. :set-theme vim_habamax switches to it right away, until dk quits or reads the config again. Type :set-theme and a space, and Tab and S-Tab step through the theme names and draw each one. Esc gives you back the theme you had.