A Neovim plugin that lets you practice your Anki flashcards without leaving your editor.
- Review due cards from any Anki deck directly in Neovim
- Practice mode - Type your answer before revealing the correct one
- Show question/answer format with keyboard controls
- Rate cards with Anki's standard 4-button system (Again/Hard/Good/Easy)
- Track session statistics
- Clean, distraction-free interface
- Image support for Kitty, WezTerm, and iTerm2 terminals
- Neovim 0.7+
- Anki with AnkiConnect addon installed
curl
command available in your system- One of these terminals for image support (optional):
identify
command from ImageMagick (optional, for image sizing)
{
"djmbritt/vimki.nvim",
config = function()
require("anki-practice").setup<
B748
/span>({
-- Optional: customize AnkiConnect URL if using non-default port
anki_connect_url = "http://localhost:8765"
})
end,
cmd = "AnkiPractice", -- Lazy load on command
}
use {
'your-username/anki-practice.nvim',
config = function()
require('anki-practice').setup()
end
}
- Clone this repository to your Neovim runtime path:
git clone https://github.com/your-username/anki-practice.nvim \
~/.config/nvim/pack/plugins/start/anki-practice.nvim
- Add to your init.lua:
require('anki-practice').setup()
-
Install AnkiConnect in Anki:
- Tools → Add-ons → Get Add-ons
- Enter code:
2055492159
- Restart Anki
-
Make sure Anki is running when you want to practice cards
-
Configure the plugin (optional):
require('anki-practice').setup({
anki_connect_url = "http://localhost:8765", -- default AnkiConnect URL
anki_media_dir = "~/Documents/Anki/User 1/collection.media", -- optional: specify Anki media directory
practice_mode = true -- enable practice mode by default (optional)
})
Start a practice session:
:AnkiPractice
Or in Lua:
require('anki-practice').start()
The plugin includes a practice mode (enabled by default) that encourages active recall:
- When you see a question, press
a
to open an answer input window - Type your answer (multi-line supported)
- Press
Esc
to save your answer orCtrl-C
to cancel - Press
Space
to reveal the correct answer - Compare your answer with the correct one
- Rate the card based on how well you did
You can toggle practice mode on/off with the p
key during a session.
During a practice session:
Practice Mode (default):
a
- Type your answer in a popup windowSpace
- Show the correct answerp
- Toggle between practice and review mode
Answer Rating:
1
- Rate card as "Again" (didn't remember)2
- Rate card as "Hard"3
- Rate card as "Good"4
- Rate card as "Easy"
Navigation:
s
- Skip card (won't affect Anki scheduling)r
- Restart session with new deck selectionq
- Quit practice session
In Answer Input Window:
Esc
- Save your answer and closeCtrl-C
- Cancel without saving
anki-practice.nvim/
├── lua/
│ ├── anki-practice.lua # Main plugin logic
│ └── init.lua # Entry point
├── plugin/
│ └── anki-practice.vim # Vim command registration (optional)
└── README.md
The plugin exposes these functions:
-- Start a practice session
require('anki-practice').start()
-- Close the practice window
require('anki-practice').close()
-- Show the answer for current card
require('anki-practice').show_answer()
-- Rate the current card (ease: 1-4)
require('anki-practice').rate_card(ease)
-- Skip current card
require('anki-practice').skip_card()
-- Restart session
require('anki-practice').restart_session()
-- Open answer input (in practice mode)
require('anki-practice').open_answer_input()
-- Toggle practice mode
require('anki-practice').toggle_practice_mode()
- Make sure Anki is running
- Check that AnkiConnect addon is installed
- Verify AnkiConnect is running on the correct port (default: 8765)
- Make sure you have due cards in the selected deck
- Check Anki's scheduler settings
- Try reviewing cards in Anki first to ensure they're properly scheduled
The plugin now supports images via the Kitty image protocol! For text-only terminals, HTML tags are stripped and only text content is shown.
Images are displayed when using supported terminals (Kitty, WezTerm, or iTerm2). The plugin will:
- Automatically detect your terminal type
- Find your Anki media directory (or use the one specified in setup)
- Display images inline with the card content using the appropriate protocol
- Properly scale images to fit the window
Supported terminals:
- Kitty - Uses Kitty's graphics protocol
- WezTerm - Uses iTerm2 inline images protocol
- iTerm2 - Uses iTerm2 inline images protocol
If images aren't showing:
- Ensure you're using one of the supported terminals
- Check that the Anki media directory is correctly detected
- Verify that ImageMagick's
identify
command is installed for proper sizing
Pull requests are welcome! Some ideas for improvements:
- Image support (Kitty, WezTerm, iTerm2)
- Support for cloze deletions
- Better HTML rendering
- Audio support
- Statistics tracking across sessions
- Custom keybinding configuration
- Support for filtered decks
- Undo last rating
- Support for more image-capable terminals (Konsole, Alacritty with sixel)
- LaTeX/MathJax rendering
MIT