Closed sdondley closed 5 years ago
I am not sure what you mean by "inserting templates". I assume you would like to start cards with a fixed content to avoid having to repeat the same content over and over. The following ways would work:
--editor-args
flag:
anki-vim --editor-args="-c set syntax=tex,-c /\v\%\n\zs(^$|^[^\%]{1}.*$),-c execute 'normal iI am a template'" DECK
will insert "I am a template" after the question header of each new card for a given deck. Brief explanation of the arguments:
-c set syntax=tex
to enable syntax highlighting-c /\v\%\n\zs(^$|^[^\%]{1}.*$)
set the cursor after the "QUESTION"
header-c execute 'normal iI am a template'
Insert the text "I am a template"
into the fileUltisnips
snippets.
Install Ultisnips, then add a file $HOME/.vim/bundle/Ultisnips/anki_vim.snippets
and define a snippet to expand to whatever template you like. Then you can simply expand that snippet for your cards. This requires the most setup, but is very flexible: you can expand the same snippet multiple times back to back, you can define as many templates as you like etc.git clone https://github.com/MFreidank/AnkiVim
cd AnkiVim
Add your desired question template here, e.g.:
write_file(temporary_file, "I am a template")
Call python3 setup.py install
to install your modified anki-vim
.
If you have any additional questions or comments, let me know.
Best, MFreidank
Closing as this issue has been stale for over a month. If there are additional questions, feel free to ask again and I will reopen this issue.
What is the easiest way to do this?