Vim Mode

AnkiWeb addon 761935116

Adds Vim-style modal keybindings to Anki's note editor, including motions, operators, text objects, registers, macros, search, substitution, and cloze-specific commands, with configurable settings.
AI-generated summary; may contain mistakes.

formattingshortcutscloze

Open on AnkiWeb GitHub Find alternatives

AnkiWeb

Votes
7 (πŸ‘ 5 Β· πŸ‘Ž 2)
Updated
2026-11-13
Anki versions
25.09.1~
License
Not found (this does not mean that the addon has no license)
Virus scan
No ClamAV match A match does not prove malware. No match does not prove that the code is safe.
Languages
JavaScript, Python, CSS, JSON
Description language
en

Maintenance

active

  • Last update or commit: 2026-11-13 (18 days before the snapshot).
  • GitHub Actions workflows: 1.
  • Commits in the last year: 31.
  • Issues: 0 open, 2 closed.
  • Pull requests: 0 open, 1 merged.
  • Median first response: 150 hours (2 answered issues and pull requests).
  • Outside pull requests: 100% of 1 merged.

Will it work on my Anki?

Version branches
Min AnkiMax AnkiUpdated
2.1.49–2026-06-11
2.1.5025.09.1+2026-11-13
History across monthly snapshots

Loading…

Similar addons

CSS Injector - Change default editor styles

Overrides Anki editor and field styling through editable CSS files, supporting night-mode, note-type, field-specific, and version-dependent style customization.

formattingappearance

21 votes 85% approval πŸ‘ 21 Β· πŸ‘Ž 0 ⭐ 9 Anki 2.1.58~ Updated 2023-02-21
Markdown input archived has 1 fork β†’

Enables adding and editing Anki notes in extended CommonMark Markdown, either directly in editor fields or in a separate window, with syntax highlighting, extensions, and configurable HTML conversion.

formattingobsolete

30 votes 63% approval πŸ‘ 24 Β· πŸ‘Ž 6 ⭐ 25 Anki 2.1.66~ Updated 2023-09-01
Anki-Coder

Adds a CodeMirror code editor to Anki flashcards with syntax highlighting, themes, live preview, double-click editing, configurable languages and note types, and mobile and cloze-card support.

formattingappearancemobile-compatible

9 votes 45% approval πŸ‘ 7 Β· πŸ‘Ž 2 ⭐ 4 Anki 25.07.6~ Updated 2026-04-22

Description

adds Vim keybindings to Anki’s note editor, so you can move around fields in normal mode and type normally in insert mode.

this add-on is intended for people who prefer keyboard-driven editing and want a more Vim-like workflow while creating or editing notes.

version 3 is a complete rewrite. if you tried an earlier version, the problems from the reviews are fixed:

features

  • normal, insert, replace, visual, visual-line and visual-block modes
  • operators with motions and counts: dw, 3dd, c$, d2w, dt,, yiw
  • motions: h j k l w b e 0 ^ $ gg G f t ; , { } ( ) %
  • text objects: words, quotes, brackets, paragraphs, sentences
  • registers ("a, system clipboard "+), macros (q, @), marks (m)
  • . repeat, u / Ctrl-r undo and redo
  • / search, :s/old/new/g and :%s, :normal, :m, :t
  • :w adds or saves the note, :wq and :q close the window
  • J / K jump to the next / previous field
  • a small mode badge in the corner (N, I, V, R)

made for Anki

  • gc + motion wraps text in a cloze deletion (gciw, or select and press gc); gC reuses the number
  • cic changes the answer inside {{c1::answer}}, dac removes the whole cloze
  • Anki's own shortcuts still work: Ctrl+Enter adds the note, and in visual mode Ctrl+B bolds the selection

type :help in normal mode for the full key list.

good to know

  • visual block is Ctrl-q, because Ctrl+V stays as paste. the vim_ctrl_keys setting g others their Vim meaning instead.
  • J / K switch fields. to join lines use gJ, or turn off shift_jk_fields in the
  • vim mode covers the normal rich-text fields, not the HTML source editor.

recent fixes

  • bump to v3.1
  • fixed j / k doing nothing on an empty first line
  • f<Space>, t<Space> and searches now find the non-breaking spaces Anki stores

settings

Tools > Add-ons > Vim Mode > Config. options include jk to leave insert mode, using the mode badge, and turning vim mode off in the Browser.

support / contact

https://jpixari.github.io

source code and issue tracking: https://github.com/jpixari/anki-vim-mode

README

Anki Vim Mode

https://ankiweb.net/shared/info/761935116

Vim keybindings for Anki's note editor: Add Cards, Edit Current and the Browser.

Normal, insert, replace, visual, visual-line and visual-block modes, operators with motions and counts, text objects, registers, macros, marks, dot-repeat, search, :s substitution, and undo that works with Anki's own undo.

Its behaviour is checked against real Vim: the test-suite runs the same keystrokes on the same text in Vim and in the add-on and compares the resulting text and cursor position.

What's new in 3.0

Version 3 is a rewrite.

  • Keys that aren't vim commands are no longer typed into your card in normal mode.
  • dd, yy, p and every other edit now happen directly in the field, so u, Ctrl+Z and Anki's undo button all restore what you deleted.
  • Deleting and pasting lines keeps bold, colours, images and MathJax intact.
  • : and Esc only act while you are in a note field. The Browser's search bar, the tag editor and Anki's dialogs are left alone.
  • Works in both the classic editor and Anki's new editor.
  • Many more commands (see below), a : command line and / search inside the editor, and a config screen.
  • A small round mode badge in the corner (green N, blue I, yellow V, red R) replaces the old pill.

Keys

A count works in front of most commands: 3dd, 2dw, 5j, d3w.

Modes

Key Action
Esc, Ctrl-[ normal mode
i a I A insert before / after cursor, at line start / end
o O open a line below / above
gi insert where you last left insert mode
R replace mode: typing overwrites, Backspace restores
v V Ctrl-q visual / visual-line / visual-block mode
gv reselect the last visual area

Moving

Key Action
h j k l left, down, up, right
w b e ge word forward / back / end / previous end (W B E gE for WORDS)
0 ^ $ g_ line start, first non-blank, line end, last non-blank
gg G {n}G first line, last line, line n
H M L first, middle, last line of the field
f F t T + char find a character on the line; ; , repeat
{ } previous / next blank line
( ) previous / next sentence
m + letter set a mark; ` + letter jumps to it, ' + letter to its line
`` back to where you were before the last jump
% matching bracket
gj gk down / up by screen line in wrapped text
J K next / previous field

Editing

Key Action
d c y + motion delete, change, yank (dw, c$, yiw, dG ...)
dd cc yy whole lines
x X s S D C Y the usual shortcuts
p P gp gP paste after / before (g: leave the cursor after the text)
> < + motion, >> << indent / outdent (nests list items)
gc gC + motion wrap in a cloze deletion with a new / the same number (gciw, gcc, or select and gc)
q + letter ... q record a macro; @ + letter plays it, @@ repeats
r + char replace a character
~ gu gU g~ change case
gJ join lines (like vim's J; with shift_jk_fields off, J does that and gJ joins without a space)
. repeat the last change
u Ctrl-r undo / redo
"a ... "z named registers; "+ is the system clipboard, "_ discards, "0 last yank, "1-"9 deleted lines

Text objects

Use after d c y or in visual mode, with i (inner) or a (around).

Key Object
w W word
" ' ` quoted text
( [ { < (also b, B) brackets
p s paragraph, sentence
c cloze deletion: cic changes the answer inside {{c1::answer::hint}}, dac removes the whole cloze
e the whole field: yae copies it, dae empties it (ie leaves out blank lines at the ends)

Made for Anki

Key Action
gc gC + motion wrap in a cloze deletion with a new / the same number
dsc remove the cloze around the cursor but keep its text
]c [c jump to the next / previous cloze
\b \i \u + motion bold / italic / underline, e.g. \biw bolds a word (also on a visual selection)
\h + motion highlight (colour: highlight_color)
\m + motion wrap in inline MathJax \( ... \)
J K next / previous field
{n}gf go to field n of the note
gt go to the tag editor; Esc returns to the field

Surround

As in vim-surround / evil-surround.

Key Action
ys + motion + char put brackets or quotes around text: ysiw) β†’ (word), ysiw" β†’ "word"
yss + char around the whole line
ds + char remove them: ds", ds)
cs + old + new change them: cs)] turns (x) into [x]
S + char in visual mode: surround the selection

( [ { add a space inside, ) ] } (or b r B) do not. c stands for a cloze: ysiwc makes one, dsc removes one.

Search and commands

Key Action
/text ?text search forward / backward (regular expressions, smart case); in visual mode it extends the selection
:noh hide the search highlight until the next search
n N * # next, previous, word under cursor
:s/old/new/g replace on the current line
:%s/old/new/g replace in the whole field (\1 and & work)
:w add the note (Add Cards) or save it
:wq :x ZZ add / save and close
:q ZQ close
& g& repeat the last substitution on this line / every line
:m {n} :t {n} move / copy the current line (or a range) below line n
:normal {keys} run normal-mode keys on each line of a range, e.g. :%normal A.
:{n} go to line n
:reg :marks show registers / marks
:help show the key list inside Anki

Visual block

Ctrl-q starts a block (a column across several lines). I and A type the same text on every line, c changes the block, d y p r ~ u U work on it, $ extends it to each line's end.

Anki's own shortcuts

Anything with Ctrl that vim mode doesn't use goes to Anki as usual: Ctrl+Enter adds the note, Ctrl+B makes text bold. In visual mode those shortcuts act on the selection, so viw then Ctrl+B bolds a word.

Settings

Tools > Add-ons > Anki Vim Mode > Config.

Option Default Meaning
cursor_blink false blink the cursor
cursor_color "text" cursor colour, the same in every mode: "text" (the field's text colour, like reverse video), "auto" (a blue that suits a light or dark field) or a CSS colour
cursor_min_width 0 minimum cursor width in em (e.g. 0.55) so it is not a sliver on i or l; 0 = as wide as the letter
mappings {} your own keys for normal and visual mode, e.g. {"H": "^", "L": "$", ",c": "gciw"}
hlsearch true mark every match of the last search
highlight_yank true briefly light up yanked text
highlight_color "#ffff00" colour used by \h
enable_in_browser true use vim mode in the Browser's editor
insert_escape "" two letters such as "jk" that leave insert mode when typed quickly
insert_escape_timeout_ms 400 how quickly they must be typed
jk_display_lines false j/k move by screen line, for long wrapped fields
shift_jk_fields true J/K switch fields; set false for vim's J (join lines)
show_status true show the mode indicator
start_in_insert false open editors in insert mode
status_position "bottom-left" corner for the mode badge
vim_ctrl_keys false vim meanings for more Ctrl keys (Ctrl-v block, Ctrl-a/Ctrl-x, Ctrl-d/Ctrl-u, Ctrl-o/Ctrl-i, insert-mode Ctrl-w/Ctrl-u/Ctrl-r) instead of Anki's
system_clipboard false yank and paste use the system clipboard

Cursor

The cursor's shapes follow Doom Emacs: a box in normal mode, a hollow box in visual mode, a half-height block while an operator (d, c, y, ...) waits for its motion, and an underline after r and in replace mode. Insert mode keeps the usual thin caret. The cursor takes the field's text colour, like reverse video in a terminal (cursor_color changes it), and is hidden while the editor window is not focused.

Not implemented (yet)

The HTML source editor (vim mode covers the normal rich-text fields), folds, windows/tabs, :g, and vim's own regex dialect (/ and :s use JavaScript regular expressions).

Known differences from Vim

The add-on is checked against real Vim with thousands of generated key sequences (tests/compare_with_vim.py). What still differs:

  • Sentence motions and objects (( ) is as) around blank lines and with counts.
  • An operator combined with a motion that cannot move, e.g. g~h in the first column, where Vim's result is a quirk.
  • . after a visual-mode command, and the cursor column after redoing a whole-line delete.
  • ` ` / '' only remember jumps made with the jump motions.
  • A yanked visual block is not padded with spaces on short lines.

Support

Issues and source: https://github.com/jpixari/anki-vim-mode

Development

node tests/test_text.js                  # motions and text objects
python3 tests/run_dom_tests.py           # editor behaviour in a headless Qt WebEngine page
python3 tests/compare_with_vim.py        # same keys in real Vim and in the add-on, results compared
python3 tests/e2e/run_anki_e2e.py /tmp/x # full check inside a throwaway Anki (own data folder)
./build.sh                               # builds anki_vim_mode.ankiaddon

Publishing a GitHub release for a tag such as v3.0.1 makes GitHub test and build the .ankiaddon and attach it to that release (the steps are at the top of .github/workflows/release.yml).

vim_text.js is pure text logic. editor_vim.js maps it onto Anki's fields and performs every edit through the browser's editing commands. vim_core.py injects the scripts and handles Esc, :w/:q and the clipboard.