Contents

How I used SuperMemo to Master Vim in 10 Days

Warning
I’m aware of this click-bait title and I’ll be honest up front: I didn’t “master” vim in 10 days. It’s a slim chance one can master Vim in 10 weeks, not to mention 10 days. By “10 days” I mean 240 hours spanned across months (like 30 minutes here and there), not 10 consecutive days. I do this for clicks to accentuate the magic that is SuperMemo and its Incremental Reading.

This article is primarily about how I use SuperMemo to learn just about anything, and I use Vim as a case in point. The ideas should be applicable and transferable to other domains and your subject of interest. To keep it short (also because I’m no veteran Vim user capable of writing on its technical aspects), if you’re interested in Vim, please google some good Vim articles. Also, my editor of choice is VS Code with the Vim extension vscodevim, instead of the full-blown Vim. To the purists I apologize. Lastly, it’s very likely that this article is riddled with technical inaccuracy. If you find any, please let me know.

Shredding text at the speed of thought

Many people vouch for Vim:

Ah, Vim. If you’re willing to invest a few months of your life into learning what is largely a non-intuitive interface, then you’ll be rewarded with a lifetime of greatly enhanced productivity. It’s that simple. Linux in Action

Ah, SuperMemo. If you’re willing to invest a few months of your life into learning how to learn with SuperMemo, then you’ll be rewarded with a lifetime of greatly enhanced autodidact-ability. It’s that simple. - MasterHowToLearn

The author’s estimation of “investing a few months” signifies Vim’s formidability and its learning curve:

./images/learningCurve_2.jpg

I remember why I wanted to learn Vim in the first place: I was fed up with having to use the arrow keys to move around in VS Code. After some googling, I found the extension vscodevim and I’ve been fascinated by Vim ever since. I like Vim so much that I’ve forked the vim_ahk and created my own SuperMemoVim, combining two of my favorite programs.

./images/vim_start.png

I started using SuperMemo to learn Vim in February 2020.

Learning Vim is a good introduction to learning how to learn

Common concerns when learning Vim

This is a common thought process when beginners are trying to learn Vim:

1. How do I [do something]?

2. I don’t know / I forget

3. Let me look that up

This thought process will repeat itself until “you’ve learned it.” How you could reach that “learned it” stage is rather elusive. Not that many people made it to the other end and may even rage-quit before experiencing the magic of Vim. The following are some common reasons or problems:

#1 Too many commands

Vim key bindings are like piano keys: a limited set of keys with endless combinations. When I started, I was confused as to why there are so many “redundant” and similar commands. For example, for the following phrase,

1
2
search for your target
^

To get to the word target, you can do:

1. www

2. ft

3. /t

Another example: When I first learned about gi, I couldn’t understand its usefulness. Its nuisance was lost on me. It was only months later that I could see the needs and brilliance of it. Now I swear by the command yiwgi<C-r>0, which yanks a word and pastes it to the previous cursor location.

#2 A manual learning/review schedule is suboptimal

This point can be generalized as this: I think any manual learning/review schedule is suboptimal, not just for learning Vim.

First, if a learning/review schedule is not spaced (i.e., spread over time), it’s bad:

If learners spread out their study of a topic, returning to it periodically over time, they remember it better.

If they interleave the study of different topics, they learn each better than if they had studied them one at a time in sequence. - Make It Stick

Improving Students' Learning With Effective Learning Techniques

Although cramming is better than not studying at all in the short term, given the same amount of time for study, would students be better off spreading out their study content? The answer to this question is a resounding “yes.”

The term distributed practice effect refers to the finding that distributing learning over time (either within a single study session or across sessions) typically benefits long-term retention more than does massing learning opportunities back-to-back or in relatively close succession.

When you space out practice at a task and get a little rusty between sessions, or you interleave the practice of two or more subjects, retrieval is harder and feels less productive, but the effort produces longer lasting learning and enables more versatile application of it in later settings. - Make It Stick

The worst way to go about scheduling what topics to learn is the following (table of contents adopted from Practical Vim):

Week 1: Normal Mode, Insert Mode, Visual Mode, Command-Line Mode

Week 2: Manage Multiple Files, Registers, Macros

Week 3: Search, Substitution, Global Commands

This is cramming, which is like trying to drink from the fire hose:

./images/information_hose.jpg

Even if you learn one topic every day, you’re still making it unnecessarily hard and the learning experience unnecessarily unpleasant because there is no need to learn so much in a day a week. You’ll likely to quit before hitting that inflection point when you understand the Vim language. There is a pretty strict hierarchical structure in going about learning Vim: if you don’t have the fundamentals down, there’s no point in learning the registers, macros, and all other advanced features.

Yes, you don’t have to rely on any particular SRS (SuperMemo/Anki) to calculate the spaced review/learning schedule, but doing it manually is like doing paper flashcards (Leitner System): you can but you just wouldn’t.

Given that Vim’s modal nature is so novel and unheard of, the need to pace yourself is even more necessary. This is one reason having SuperMemo’s Incremental Reading to schedule the reading/learning/reviewing for you is so crucial.

How SuperMemo and its Incremental Reading come to the rescue

SuperMemo + Hands-on practice: Declarative Knowledge and Procedural Knowledge in Tandem

From How Learning Works

There are many different types of knowledge:

Declarative knowledge [is] the knowledge of facts and concepts that can be stated or declared. Declarative knowledge can be thought of as “knowing what.” The ability to name the parts of the circulatory system, describe the characteristics of hunter-gatherer social structure, or explain Newton’s Third Law are examples of declarative knowledge.

A second type of knowledge is often referred to as Procedural knowledge, because it involves knowing how and knowing when to apply various procedures, methods, theories, styles, or approaches. The ability to calculate integrals, draw with 3-D perspective, and calibrate lab equipment—as well as the knowledge of when these skills are and are not applicable—fall into the category of procedural knowledge.

Declarative and procedural knowledge are not the same, nor do they enable the same kinds of performance. It is common, for instance, for students to know facts and concepts but not know how or when to apply them. In fact, research on science learning demonstrates that even when students can state scientific facts (for example, “Force equals mass times acceleration”), they are often weak at applying those facts to solve problems, interpret data, and draw conclusions.

Similarly, studies have shown that students can often perform procedural tasks without being able to articulate a clear understanding of what they are doing or why. For example, business students may be able to apply formulas to solve finance problems but not to explain their logic or the principles underlying their solutions.

Similarly, design students may know how to execute a particular design without being able to explain or justify the choices they have made. These students may have sufficient procedural knowledge to function effectively in specific contexts, yet lack the declarative knowledge of deep features and principles that would allow them both to adapt to different contexts and explain themselves to others.

Be sure to differentiate declarative (knowing what and knowing why) from procedural knowledge (knowing how and knowing when), recognizing that just because students know facts or concepts does not mean they will know how to use them, and just because students know how to perform procedures does not mean that they understand what they are doing or why.

Diving headfirst without reading and learning from Vim help files is having limited declarative knowledge to work with. “Use it until it becomes ‘muscle memory’” is not going to work because you aren’t likely to be aware of better alternatives. Yes, you’ll quickly google better ways if you’re always spamming wwwww, but googling can only take you so far without reading the Vim help files to understand its philosophy, aka the Vim way.

Remembering what Vim commands and combos are available is the first step to using Vim effectively and efficiently. This is prior knowledge in long-term memory that you can apply later on. In theory, when you want to do something, your brain will present a few options (memory retrieval from long-term memory to working memory), then you can consider a few options and pick the best. It’s about lessening the cognitive load in working memory in order to think better. In practice, it’s more about learning and remembering the “best” possible move and then sticking to it.

There’s no substitute for real hands-on practice. “Learning Vim” and “learning about Vim” are two very different things. You can read about Vim all you want, but if you don’t use it, you’ll never master it. On the other hand, using Vim daily will not guarantee mastery because it doesn’t entail going beyond the basics. If you’ve learned the basics, then you’ll use that subset of commands and features. The problem with being good enough is that, well, it’s good enough. There usually isn’t enough impetus to improve upon the good enough Vim-fu. But if you want to take your Vim game to the next level, you can’t avoid the “advanced” features and commands. You have to learn and remember the Vim way and then apply what you’ve learned. Learning and applying complement each other.

Transfer of Knowledge

I think transfer of knowledge is a probabilistic notion. For example, I have this item in SuperMemo:

./images/vimItem.png

At least the following options:

1. vwwwwhd

2. vjbhd

3. v/ge<CR>hd

4. d/ge<CR>

According to Practical Vim, option 4 is the best one (using search motion to tell the delete command what to delete). Even though I may be able to come up with option 4 to do it during practice (i.e., when retrieving the answer for this flashcard), when I encounter similar situations in the wild (i.e., during actual programming), I may or may not have the awareness to use the same strategy. In other words, I may or may not remember to use d/ge<CR>, and instead fall back to vjbhd, or even vwwwwhd.

The point isn’t about saving that half a second but rather, the idea of transfer of knowledge: applying new knowledge to new context and situations. By Incremental Reading in SuperMemo, I hope to acquire declarative knowledge, i.e., the Vim language, its philosophy and why’s. The Vim items in SuperMemo above are meant to be “artificial hands-on practice”, to practice the procedural knowledge, i.e., the how’s. Through this I hope to acquire both declarative knowledge and procedural knowledge so as to stick to the best practice and thus, master Vim. For example, I read and learned about macros. I know about the existence of macros, so when trying to automate some frequent tasks I’ll (hopefully) think of using macros instead of using lots of . commands. This is an ideal situation of course, and this is why I think transfer of knowledge is a probabilistic notion; it has to do with the uncertain and unreliable nature of memory.

My reason for having these items is that SuperMemo will act as a series of stepping stones, so that when I need “the best possible commands” my brain will (hopefully) pop out the correct answer:

./images/NSMB2_2.jpg

Lacking meta-cognitive awareness is the bottleneck in taking your Vim game to the next level

My understanding of lacking “meta-cognitive awareness” is that you don’t know any better (not in any derogatory sense). Think back to your personal experience: You may be walking the same path to school/work for years, then suddenly discover there is another route that shortens your commute time by 30%. Or this story about a developer who got bitten by a deer tick and was finally and properly diagnosed with Lyme disease 15 years later. These are surely the “I wish I’d known” moments.

For Vim, you may have these similar “I wish I’d known” moments. For example, you may be spamming j to move down the cursor when you don’t know Ctrl+F can do so a lot quicker (because by default it scrolls down half a screen), since you’re used to spamming with j. Or if you’re comfortable with dw, you may not realize daw is a better command (with dw you have to place the cursor at the beginning of a word but daw deletes the whole word regardless of your current cursor position.) Or you may be repeating the previous command with . and never realize you could use a macro that may suit that particular task better. We don’t know what we don’t know. It sounds tautological but hopefully, you’ll get my point with the following example.

1
2
The quick brown fox (Vulpes vulpes) jumps over the lazy dog
                    ^

If you didn’t know about %, you may use f) to jump to the ending bracket. But using % is better because it’ll jump to the corresponding matching bracket (regardless it’s ] or )), but with f you have to think whether it’s f) or f]. Surely if you knew % you wouldn’t be using f) or f]. The key is realizing (i.e., having the awareness) that “oh I should use % instead of f) to go to the matching bracket.”

The book Practical Vim has a lot of these hard-earned tips and tricks. If you read it you’re off to a good start because you’ll be learning from someone who’s used Vim for more than a decade, so you don’t have to reinvent the wheel. Of course, there will be personal unavoidable tips and skills that you wish you’d known, but reading and learning from experts mean “standing on the shoulders of giants” before venturing off. If you don’t read and learn, you’ll not likely to discover other useful commands and features because you don’t know there are better commands available. Hence, the question “how to go about learning beyond the basics” or “how to better consume the book Practical Vim” becomes more important.

How I used SuperMemo to learn Vim

PS: The main focus is my reasons behind learning with SuperMemo. For a practical “getting started with SuperMemo” guide, please watch Starting with SM Going through the IR Manual.

SuperMemo’s Incremental Reading is about using the spaced repetition algorithm to combine the reading and learning process. For more please read Three Secret Sauces Behind the Magic of SuperMemo’s Incremental Reading

First Incremental Reading Material: Boost Your Coding Fu With VSCode and Vim

I imported all the chapters of Boost Your Coding Fu With VSCode and Vim into SuperMemo for Incremental Reading. Here’s my Knowledge Tree for the book:

./images/VimKT.png

Vim Items in SuperMemo

To follow the tradition of talking about quitting Vim, here’s how I remember how to quit Vim:

./images/quitVim.png

My Vim items (flashcards):

./images/yas.png

As you can see, I first did this flashcard on Feb 19. After 2 more correct answers, SuperMemo sent it 373 days into the future. I’ll review this item again on April 27, 2021. This is just the regular Spaced Repetition Software: active recall (retrieval practice) with an ever-expanding interval. But here’s the key difference that makes SuperMemo different from Anki: I don’t have to immediately make the above flashcard. The source of this flashcard is actually from the following extract:

./images/extractSource.png

Extracts are simply “highlighted important parts.” The content is from chapter 12 of the book. From the review dates, I first made this extract on Feb, 05. Then SuperMemo showed it to me again on Feb, 17. On that day, I further extracted (highlighted) the blue sentence, because I thought it’s important. From that blue extract born the above flashcard.

You can see it’s an incremental process (hence the name Incremental Reading). All of these review schedules are handled by the SuperMemo’s algorithm. Without the 12 days (Feb, 05 -> Feb 17) cool-down period, I’m sure I’d have made a lot more cards due to the novelty bias (i.e., “everything looks important and shiny. Let me turn all of them into flashcards.") For more please see: Incremental Extract Processing (I): Superior Metamemory Judgments.

In Anki, the reading material is not in the review queue, so if you don’t make the flashcards right away, it’s lost. It’s a “now-or-never” decision unless you intentionally schedule re-reading the learning material.

Here’s another example:

./images/noItem.png

These extracts never made it to becoming flashcards. When I first read about them I thought they were important. They were, but the concept of modal editing is so fundamental and integral to Vim that “using Vim” is already embodying such concept. There is no point explicitly learning about it when I’m already using it. Making flashcards out of them is just redundant. More often than not, re-reading a Vim command or tip when it shows up in the outstanding queue, then trying it out in Vim is enough. I rarely need to make flashcards out of them.

Here’s another example:

./images/exCommands.png

Almost everything is in blue. My thought process was (probably) “it’s important not now, but in the future”. When I first started out I didn’t have to use (and learn) about Ex commands, so I extracted this part, and SuperMemo will schedule it for future reviews. It’s a bad idea when you’re struggling with hjkl and on top of that be learning about Ex commands; that’s just adding insult to injury.

Second Incremental Reading Material: Practical Vim

If you want to truly master Vim this is an absolute must-read.

Automatic Review Schedule

./images/sendFuture.png

Have I stopped learning about Vim? No, far from it. As you can see, SuperMemo will show me this “Tip 59 Snap Between Files Using Global Marks” (from Practical Vim) on Feb 25, 2021, which is 350 days into the future when I first encountered it.

Imagine today is Feb 25, 2021. This tip will automagically show up in my SuperMemo’s outstanding queue, and then I can decide if I want to learn about it. I may be learning about js’s async function and then BAM! “Tip 59 Snap Between Files Using Global Marks”. SuperMemo will show me this one “advanced” Vim tip that I’d extracted almost a year ago. Then I can read about this feature and try it in Vim. I may find it incredibly useful and remember it by natural repetitions (i.e., using it a lot); or if I don’t find it useful I’d dismiss this extract.

./images/appear.png

Another point. As you can see from the picture: on March 12, 2020 (roughly a month after started to learn Vim), SuperMemo showed that Topic to me but I didn’t want to learn about “global marks” when I was still struggling with choosing between www, ft and /t. I didn’t read this tip and pressed “Next”, hence SuperMemo sent it 350 days into the future.

Incrementalism: one step command at a time

SuperMemo’s Incremental Reading is about having an algorithm to handle all the scheduling for me, so I can forget about “forgetting to learn”. No planning is required. I don’t have to consciously and intentionally schedule a time to learn Vim. They just pop up in my outstanding queue. This is how I learned most of Vim’s advanced features like macros, marks, registers, window layouts, and so on.

“Incrementalism” embraces the concept “slow and steady wins the race.” Like with everything, there are always better and worse ways to go about it. For example, I’ve been navigating around VS Code with the arrow keys like an idiot until I discovered Vim. And before that, I was typing with only two fingers, and before that, I wasn’t even touch typing and had to look at the keyboard while typing. Incrementalism is about learning one Vim tip at a time, doing one flashcard at a time, reading one extract at a time.

Getting Started to learn Vim with SuperMemo

1. Download the free SuperMemo 15 (SuperMemo is unfortunately only available on Windows). For virtual machine, parallels is performant but VirtualBox is free.

2. Import all the chapters of Boost Your Coding Fu With VSCode and Vim (it’s free) or Practical Vim (the epub version is available for purchase) into SuperMemo (More: Demonstration: My Workflow of Incremental Reading)

3. Extract parts that you think are important. Don’t immediately create flashcards out of them. (More: Incremental Extract Processing (I): Superior Metamemory Judgments)

4. When SuperMemo shows you an extract, create items (flashcards) according to 20 rules of knowledge formulation or dismiss it (not important).

5. Do the flashcards repetitions diligently and you’ll well on your way to Vim mastery.

Conclusion

Thank you for reading thus far. If you’re serious, try learning Vim with SuperMemo to understand my hype for both programs. If you do, I can guarantee you won’t rage-quit this time. Don’t like Vim and are using Emacs? No problem. Import the whole Emacs documentation to master Emacs.

Note
Regarding the name of my blog, “Master how to learn”: master is a verb; not a noun as in “Master How-to-learn.” I’m not self-absorbed enough to be calling myself a master of well, anything.

This article captures a lot of my learning ideas (how to best take advantage of spaced repetition, how to use Incremental Reading, transfer of knowledge, etc). I’m not sure how accurate or true they are. Is this learning approach suitable for you? Please see it for yourself and as always, take my words with a grain of salt.

For further reading, please see Augmenting Long-term Memory, Memorizing a programming language using spaced repetition software and How to Learn to Code I - Use SRS and Anki.

:wq