Caution: Vim, like SuperMemo, has a steep learning curve (not as deep as SuperMemo though). I don’t think you should try SuperMemoVim if you’ve never heard of Vim while just learning to use SuperMemo.
The target audience of SuperMemoVim:
1. You are on Windows since it’s an AHK (AutoHotKey) script.
2. You’re already a SuperMemo warrior (not the warrior layout but at least a few months under your belt).
3. You’ve braced yourself for frustration ahead (not necessarily with just SuperMemoVim but also Vim itself).
If you want to dive right in, head over to the GitHub repository, download the repository, unzip to use it.
Do the best you can until you know better. Then when you know better, do better. ― Maya Angelou
A long time ago I wrote The Complete Guide to Using SuperMemo with Only the Keyboard. I concluded with “this is the closest thing to effectively navigate SuperMemo with minimal hassle and hand movements.” How wrong was I. That’s not the complete guide. This is THE complete guide.
SuperMemo made me question, “Why I didn’t learn/read like this before?” Vim did the same: “Why didn’t I type/write like this before?” What SuperMemo has done to my learning/reading is what SuperMemoVim has done to my interaction with SuperMemo. Combining SuperMemo with Vim is just a match made in heaven.
Preparation Before Getting Productive With SuperMemoVim
If you’re interested, I highly recommend trying the real Vim Editor; do the
vimtutor, or this online game Vim adventures or Interactive Vim tutorial. Then once you’re familiar with Vim itself you may give SuperMemoVim a go.
There are numerous articles on Vim. My absolute favorite is Vim Creep. Granted, Vim is especially useful for programmers; but just as Emacs’ Org-mode is useful not only for programmers but for Writing a PhD thesis with Org Mode, or Emacs for Writers, Vim is not only limited to programmers.
Brief Introduction to Vim
Vim is modal. It has a bunch of modes that change the functionality of the keys, shortcuts and, behavior. When you want to type something in, you put it in insert mode where it behaves mostly like what you would expect an editor to behave. If you want to move around the file, and issue commands you go into normal mode, and suddenly every single key on your keyboard has at least one or two powerful functions bound to it. ― Why Vim?
Vim is a modal editor: it has different modes for inserting text vs manipulating text:
Normal: for moving around a file and making edits
Insert: for inserting text
Replace: for replacing text
Visual (plain, line, or block) mode: for selecting blocks of text
Vim avoids the use of the mouse, because it’s too slow; Vim even avoids using the arrow keys because it requires too much movement. The end result is an editor that can match the speed at which you think. ― Editors(Vim)
It may be helpful to view each mode as a layer. With Normal mode, Visual mode ,and Command mode, you have over a hundred key combinations at your disposal. For example,
a (Normal mode),
va (Visual mode) and
:a (Command mode) are all three different AHK triggers.
For some good introductions please see Learn vim For the Last Time: A Tutorial and Primer or Vim Novice Videos.
SuperMemoVim: SuperMemo + Vim
In SuperMemo, we deal with text heavily. SuperMemo itself provides a lot of keyboard shortcuts (129 to be exact). But most of the shortcuts are for core functionalities but not text manipulation, for example, jumping to end of line, delete previous word, jumping to next paragraph etc.
So what’s better than using Vim’s ubiquitous modal nature in SuperMemo? By combining SuperMemo with Vim, I, very generically, call it SuperMemoVim (inspired by VScodeVim). Side note: If you’re using Anki I think Vim can be fully integrated into Anki since both of them are open-source (the name AnkiVim is very nice).
The tagline of the book Practical Vim is “Editing Text at the Speed of Thought”. My tagline for SuperMemoVim is, again, very generically, “Learning By Editing at the Speed of Thought”.
Some gifs to show you what SuperMemoVim can do
The key overlays shown are not what I typed. They are triggered by SuperMemoVim, which shows you how much more convenient it can be.
shift+v shift+j shift+j e:
q :b shift+j shift+j j :a:
q j j A:
j j 0:
q j j v w c:
Vim’s Modal Nature in SuperMemo
If you’re using Vim, you already know it’s an amazing text editor (Emacs is equally amazing too). By emulating Vim’s modal nature in SuperMemo that is distinct from typing, you have essentially all the keys as triggers for AHK scripts. With just AHK you’re limited to key combos such as
Ctrl + Alt + a or
Shift + Alt + b. First, you’re quick to run out of combo. Second, many of them clash with existing SuperMemo shortcuts. Most importantly, they’re straining to press (
Shift+Ctrl+1to deHTML-ize HTML if you do this one hand) or require major hand movement (
Shift+Ctrl+F6 to view source code of HTML).
To make a musical analogy, let’s compare the Qwerty and piano keyboards. A pianist can pick out a melody by playing one note at a time or he or she can hold down several keys at once to sound a chord. In most text editors, keyboard shortcuts are triggered by pressing a key while holding down one or more modifier buttons, such as the control and command keys. This is the Qwerty equivalent of playing a chord on the piano keyboard.
Vim’s Normal mode commands are designed to be typed as a sequence of keystrokes. It’s the Qwerty equivalent of playing a melody on the piano keyboard. ― Practical Vim
For example, I constantly need to switch between SuperMemo and Balabolka for dual encoding. With SuperMemoVim, I can assign the key
r in Normal mode to switch from SuperMemo to Balabolka, instead of the Windows shortcut
#3. To me, saving one keystroke is not as important as staying on the home-key row and not moving my entire left hand to reach for that key combo.
Another example. With SuperMemoVim I can activate Visual mode with
v, then after selecting paragraphs with
g to create an extract. Without it, I’d need to
Alt + X
Since SuperMemoVim (AHK scripts) acts as the interface, it intercepts your keyboard keys before sending them to SuperMemo (i.e., Keyboard keys -> AHK -> SuperMemo)
This also means that we can secretly change SuperMemo’s default shortcuts. This can be very handy. Consider replaying the audio (
Ctrl+F10). I have yet to develop the ability to locate F10 without looking. But with SuperMemoVim I can simply remap it to
r (mnemonic for replay) in Normal mode. Or consider View source code of HTML (
Shift+Ctrl+F6) or (
Shift+Ctrl+1) Text : deHTML-ize, with SuperMemoVim I can map it to just one keystroke in Normal mode.
Workflow is Over 9000
Using SuperMemoVim has taken my SuperMemo workflow to a whole new level:
- I can navigate between programs easily: I use SuperMemo in conjunction with other programs like Balabolka and VSCode. For example, I have set it in Normal Mode
Ctrl+s to bring the text from SuperMemo to Balbolka for TTS. Another example: while Incremental Reading I used to spam the
Down key. Now I just need to press
n to scroll multiple lines.
- Reaching for the mouse is troublesome. Now I can mostly ditch it (edge cases being image occlusion or searching). Given SuperMemoVim is not the real Vim, for long-distance navigation like selecting multiple paragraphs or going back to the top, I still use the arrow keys. One thing is certain, however: I rarely need to use the mouse.
- My hands mostly stay on the home row keys (source):
Smoother SuperMemo Experience
I really like this description from Boost Your Coding Fu With Visual Studio Code and Vim:
Vim thins the interface between your brain and the computer.
SuperMemoVim (Vim) does not only help me edit faster. Speed isn’t really the concern. It’s the thinner interface, the rhythm, the flow, the choreography. It’s “I can express myself better and faster with the keyboard”. To delete a line:
Backspace for literally 10 seconds.
Using Windows/Mac shortcuts:
Ctrl/Cmd + Home —>
I think the most useful ones are
l. So just basic navigations and inserting at the beginning or end of a line.
Remap for grading:
12345 respectively. Previously I needed to reach for the number row. Now, very conveniently I don’t have to. This is never possible with modeless typing, because you need
asdfh to actually ouput their keys.
Caution: The following are all SuperMemoVim specifics
From vimahk to SuperMemoVimahk
I think vim_ahk is the best Windows’ Vim emulator. It’s meant to be using Vim everywhere. I’ve forked it and tweaked it to be only SuperMemo-specific:
- Remove all “advanced” features, like searching and replacing. They don’t work with SuperMemo.
- Remove all incompatible features that clash with SuperMemo default shortcuts.
- Added some SuperMemo-specific features. Like after extracting/clozing in Visual Mode, then go back to Normal Mode.
- I’ve added a script that disables some “dangerous actions”: you could never be too safe.
Remapping default SuperMemo Shortcuts
I highly recommend remapping
Control (I followed this guide) to make the most out of SuperMemoVim.
I have some non-Vim standard mappings. My choice is purely ergonomics. Without mnemonics, it is harder but eventually, I got used to them. Another example. In Visual mode:
Since I’ve already selected the target, I can just press one key to cloze/extract it. As you can tell, I’ve remapped the shortcuts that require the
Left Alt. Bending the left thumb is straining.
Training Wheels for Faster Neural Rewiring
Caution: Since getting familiar with Vim is hard enough, I’d recommend remapping SuperMemo’s default shortcuts only you’re comfortable with simple SuperMemoVim.
As you can tell, this requires substantial neural rewiring (changing your old keyboard habits), especially if you’ve used SuperMemo for a long time. This is yet another learning curve. Old habits die hard.
“Training wheels” is very most helpful in remapping old keyboard habits. Just like training wheels in Vim, one very good way to speed up this process is to disable old shortcuts. For example,
!c::return prevents bringing up the Knowledge Tree the old way. Over time I will no longer press this key combo because it couldn’t achieve my intended purpose.
First, a lot of Vim’s features don’t work. The most useful ones like text objects
dt. don’t work. Yes, it’s annoying not having
Fx within a line so I always have to resort to
One critical flaw of SuperMemoVim is that there is no cursor indication of which mode you’re in. In Vim a block cursor means editing mode and the thin cursor means in editing mode. So sometimes I need to peek at the lower right corner to see which mode I’m in. But since I’ve used it long enough I don’t have to do this frequently. A good habit of using Vim is always to be in Normal mode. If you know how to emulate the Windows cursor like Vim please tell me, I really want this feature.
SuperMemoVim is not for heavy text editing or manipulation. It’s only good for light text editing simply because it’s not the real Vim. It’s my very poor emulation of the Vim emulation for Windows by rcmdnk. If a thought strikes, I will bring up the real Vim with this script and write in the home sweet home of Vim.
Make It Your Own
It’s been almost 3 months since I first made SuperMemoVim. I’m still constantly tweaking it to suit my particular workflow.
As no two
.vimrc (Vim settings) are the same; no two SuperMemoVim should be the same too. The one in the repository is barebone: it’s meant to be a starting point so you can add your own custom AHK triggers and scripts.
The one I’m using is really messy; with a lot of custom scripts and non-standard Vim bindings. I encourage you to tailor SuperMemoVim to suit your particular workflow. Your keyboard is your canvas.
Do I think everyone should use SuperMemoVim? No.
Do I think everyone should use SuperMemo? Yes.
“Why did I discover this only until now?” I’d never heard of Vim until this February. Vim’s modal nature is so brilliant and revolutionary that, like SuperMemo, it made me wonder how I could type and write without it before.
SuperMemo and Vim are long-term endeavors. SuperMemoVim, being their combination, is no exception. It was hard for me to learn to use Vim. When I first tried Vim Adventures, I couldn’t even navigate with
jkhl; I had to think for 3 seconds before “oh yeah
h to move to the left”. Now it has become second nature, just like touch-typing or riding a bicycle.
Like SuperMemo, once you’ve overcome the initial learning curve the rewards are astronomical (yes not big, not huge, but astronomical). Once you’re used to typing with Vim, you can never go back:
Sometimes, you edit text outside of Vim. These are sad times. Enter vim-anywhere!
To be honest, I don’t think most people would need SuperMemoVim. Learning Vim is overkill in order to use SuperMemoVim; but without learning the philosophy of Vim, SuperMemoVim won’t make much sense. But if you can embrace Vim’s ubiquitous modal nature, then I can guarantee SuperMemoVim can take your SuperMemo workflow to another whole new level.
I have no idea how many people will actually try and use SuperMemoVim. But if you do, I hope you’ll enjoy this little creation.