I used VS Code, Sublime, Notepad++, TextMate, and others, but the shortcut with
cmd(+shift)+end, jumping with
option+arrow-keys from word to word, needed to be faster at some point. I was hitting my limits. Everything I was doing I did decently fast, but I didn’t get any faster.
Vim is the only editor you get faster with time.
Vim is based solely on shortcuts. When I discovered that and played around a bit, I felt numb and a little stupid, having not learned the shortcuts (called Vim language) much earlier in my career. I realized there was a keystroke to get to any specific position I wanted to jump. It was like a game, using fewer shortcuts to accomplish a particular edit. It’s where many of Vim users get a lot of pleasure from coding and writing. I felt liberating, moving my cursor with the precision of a surgeon now.
Although speed is a smaller benefit, it got me started when I saw others navigating in Vim. After I climbed the steep learning curve, it’s still one of the most powerful skills I will learn in my career, working for a living on a computer.
Let’s get behind the myth of Vim, how it’s possible to remember all the shortcuts with a specific vim language, how you move with vim motions, the back story of what I’ve learned so far, and why you might give it a try as well.
Behind the Myth of Vim
Lots have been said about Vim, how fast it is, how only Linux nerds use it, and that it’s impossible to Exit Vim.
For myself, I got in love with the “Vim language”. As I’m bad at remembering anything and thought, Vim is nothing for me. But that didn’t happen for one specific reason. The Vim motions and its languages. I learned that there’s a grammar behind the editor. With it, you express what you want to do first, how many times, and then what you want it to apply.
Let’s get deeper into Vim and the language behind it.
The Vim Language (and Motions)
Vim has a terrific language or grammar behind its shortcuts. Instead, remember a thousand shortcuts; you can learn a couple and combine them. These are sometimes called the Vim language or Vim motions for moving around. This has nothing to do with the editor yet; they are universal and available in other editors as well.
For example, VSVim for VSCode, IdeaVim for the JetBrains products, Vintage Mode for Sublime and so on. But there are also Browser extensions like Vimium or Firenvim, even Gmail adapted some of its shortcuts for navigation (
k for moving,
g for jumping).
Everyone who types on a computer eight hours a day should learn the Vim language. Yes, it’s hard in the beginning, but that’s everything new and different, but getting better every day and having more fun coding or writing should motivate enough. The excuse of being too busy to learn while doing what you always did does not count.
As grammar has verbs, subjects, and objects, so does the Vim language. The grammar has different verbs to begin with. Copying (or yanking) in Vim with
y, deleting with
d, pasting with
p, changing with
For example, the easiest shortcut is copying a line with
yy. In this case, yank is the verb and the second
y is a synonym for
y is doubled up to make it easier to type since a joint operation.
Next, we can add movements. Each verb takes a subject to their movements. There are lots of movements (more in the next chapter); the easiest is with numbers. E.g. to copy three lines, you add three in front, such as
3yy. You can do that with all verbs, e.g., deleting three lines
3dd. Another would be
} to move to the beginning or end of the paragraph, respectively.
In addition to verbs and subjects, the Vim language also has objects. E.g., we can save text into different clipboards (called a register in Vim) with
"ay. Here, we copy it into register a, which would be the object. We can paste it again by doing the same but using the verb paste instead of yank
If you will, there are even adjectives and adverbs with prefixes. Usually, you use a verb and an object. But instead of going down three lines with
3J, which joins the following three lines. You could add
d5}, which means “delete from the current line through the end of the fifth paragraph down from here.”,
For me, the most considerable magic and myth about Vim. All of the vim language is how you navigate end edit text, and it still has nothing to do with the editor. Sure Vim was the one that introduced and perfectionized them, but as listed above, you can get them anywhere else. This goes deep into the Vim language, yet we still need to touch the editor. This is important to know.
I hope you start seeing the power of such a pattern. With a couple of verbs and objects, you can already know hundreds of combinations without memorizing them. You can see a video on Mastering the Vim Language on the Vim language or read a full plea for the Vim language on a terrific StackOverflow comment.
As touched in the Vim language. Vim motions are how you navigate, whether you navigate to the end of the word or back to the start of the document; these are all motions.
These are the first thing you start learning (and hating) when you start learning. It’s extra hard to know initially, but something you want everywhere when you get used to it. Instead of using arrow keys, Vim uses
jk to move down and up and
hl to move left and right. The main idea is to use the keys that your right hand naturally rests on. You do not need to move any of your hands or even fingers for navigation. Again, this seems like a small thing, but once learned, you know why everyone is telling you that.
Some common ones are:
You find the most important ones to start in this cheatsheet:
Modes (normal, insert, visual, command)
Modes are what get you confused at the beginning. When you launch Vim, you are not typing what you click on your keyboard as you are not in the “insert” mode that you know. Instead, the normal mode you are in lets you do the commands explained in the above Vim language and motions.
Vim is the only editor that optimizes editing text instead of writing from a blank page.
That’s another reason Vim makes you so efficient: you have different modes for each phase of your task—normal mode for reading code and navigating quickly. Insert mode when you want to add some code or text. Visual mode is unique, the same as highlighting text with the mouse, but with the above Vim motions. The command mode is the powerhouse, where you can type Linux commands such as formatting a JSON file with
:%!jq (whereas jq is a command line tool installed on your machine) and execute them within Vim. As well as Vim commands such as
:sort for sorting your file.
I could go on here, but I want to dive into the editor itself now and explore why I learned it initially and how to get started if you’re going to.
Vim the Editor (NeoVim, LunarVim, Helix)
So what is Vim the editor, then? It started with the simple vi editor, a basic editor that implements the Vim language and can edit text. Little like Notepad++, which you might use on Windows, but without a mouse and context menu.
Vim is simply an improved version of Vi with more features.
Today there is even a newer version of Vim called Neovim. This version is super popular, and I’m using Neovim as well. Compared to Vim, Neovim uses Lua, an actual programming language, to configure and extend Neovim. This makes writing plugins and configuring Neovim easier to Vims native Vimscript.
There is also an editor called Helix built in Rust, but it has minor deviations from the Vim language, which make it a less optimal choice to start.
Easiest to get started without needing to know anything about Neovim and spending hours of configurations, you can begin with LunarVim, a distro with all features you know from VS Code included. Suppose you are comfortable with the terminal and realize you want to change the editor to your liking. In that case, you can kickstart your journey with a simple single-file configuration with many explanations that will work out of the box. You can also learn each config by opening the single config file.
Why I learned it
Unlike the standard input method we use daily, you stagnate at a certain level. Sure, you can use
cmd+arrow-keys (on a Mac) to jump to the beginning of a line or
option+arrow-keys to jump between words instead of characters.
But what if you mastered that? What if you need to change something in the middle of a sentence? There is no other way to jump several times with this option, or you move your hands away each time to reach the mouse to click on the exact spot.
I was there and saw a coworker move in Vim; it clicked. The Vim language and motions were the things I needed all along. And I started to install the VS Code plugin, watched a couple of YouTube videos, and started my journey to learn the basic movements.
I also love learning new things and, even better, under the umbrella to make me more productive 😉. But as many of you might have experienced, the hardest part is to get started. The initial learning curve is very steep. Below is an illustration that illustrates that :).
It took me also two or three times until I fully grasped it. I switched forth and back. As well as having to get work done, it is sometimes hard to switch entirely from one day to another. But I just loved learning all the movements, and I knew it would make me faster after a short time.
What I have learned so far
I have been using Vim for only eight months, coding with Python for around six years, and using editors since my career started in 2003. Each editor I used had its strengths and its appeal. But I never had such a gain in any way as with Vim.
In the end, use the editor that works best for you. The argument that the editor needs to work as fast as possible must be clarified, mainly if you use it daily. Investing much time is necessary, but that pays off over time. That’s the whole point with Vim and especially Vim language.
An underrated skill is using the terminal. By learning your editor, especially with Vim, you will naturally learn more about the terminal and improve with Linux (reverse search, lazy git, Tmux, and many more). Before Vim, I only used the terminal if I had to. I googled everything, and today, I use the terminal with its influential manuals whenever I can. Sometimes I’m surprised by myself as well, and it’s super nerdy, but it’s so effective, and I’ve been a much better developer ever since.
Tweaking and optimizing Vim can take hours and days, which in the beginning, is not avoidable. But after a while, your dotfiles mature, and you start changing less. You will also get much faster at trying out a new plugin or adding a remap.
It’s fun! Working in Neovim is one of the highlights of my everyday work. Improving your text editor and making it your unique editor nobody has optimized for my workflows. For example, I write a lot, so I optimized for writing markdowns and programming in Python. That’s what adds a lot to my happiness as a coder.
Vim also manifested minimalism more in me. I used the terminal instead of fancy GUIs and plain text files for clarity, freedom as blazingly fast, no vendor lock-in, and staying in the Flow with the content in front.
Vim changed not only my workflow but how I can edit at the speed of thought. Instead of thinking, “I want to edit that word”; my fingers jump to that word and change it with a few keystrokes.
Vim for Data Engineering
Vim for Writing
I’m still using Obsidian a lot more for writing (see more on my PKM workflow) due to its additional features of supported images, backlinks, graphs, and plugins specified for note-taking, such as ReadWise (syncing my highlight from books, and tweets), Dataview (using notes as a database), Excalidraw (drawing with Markdown format), Templates, etc.
Nevertheless, I write more and more in Neovim also for writing. For now, I use ZenMode (for centering the text), Grammarly (for linting grammar), write-good(linting grammar), and specific Obsidian.nvim (follow backlinks, etc.). You find all details in my dotfiles.
In Obsidian, I use the Vim mode Obsidian .vimrc and map most hotkeys to my Vim settings. At the same time, I write more and more in Neovim and progressively move over to full Neovim in a year or so. Plugins such as Telescope and simple grep features that I use for coding work very well with Markdowns. A few clips of what is possible on an excellent talk about Writing, Editing, and World-Building at the speed of thought with Vim.
Why You Should Learn It Too
When I heard about Vim, I thought that is only for software engineers and Linux nerds 😅, but I never thought I was going to use it as well. But how did I get into it?
If the above has yet to convince you, you might not be the person working all day in text. Vim changed all my workflows, not only as a developer but also how I surf the internet, write, navigate, and use tools. I search for a Vim mode in any application I use.
How to Get Started
There are many good resources. The easiest is to type
vimtutor, which is an interactive tutorial for Vim.
I started with Ben Awads’s Vim tutorial back then. An excellent Lecture: Editors (Vim) (2020). Mastering the Vim Language. I also collect a small playlist on YouTube with Vim content. A big inspiration also dev workflow using Tmux and Vim from Takuya.
We have learned that Vim is a powerful text editor popular among developers. Based on shortcuts, called the Vim language, which can make coding and writing faster and more efficient. With Vim, you can jump to any specific text position and rapidly make precise edits. While learning Vim can be challenging, it is well worth the effort in the long run as it will improve your productivity and bring joy to your coding experience.
If you want to go further, try Tmux, which plays well with Vim. You could even go one more level deeper, which is a dedicated keyboard layout such as Dvorak or Halmak (which I started learning at some point). Or buy a fancy ergonomic keyboard or build one yourself.
Thanks for reading this far; I hope you enjoyed this article. It was written quickly and has many errors, but I wanted to get it out there anyway.