The next time you’re writing on your computer, pay attention to how much time you spend on editing text. How often you move the cursor. Or select some text to erase it. Scroll up or down a document. Jump around pages, chapters, paragraphs, sentences, and even words. Your hands are almost always switching between the keyboard and mouse when writing. These micro actions seem insignificant, but the time and effort they add up to are definitely not-so-insignificant. Imagine if you could cut them all out of your process. You could just wish a paragraph would disappear and instantly it would. Or just think about jumping to the bottom of a page, and you’d be instantly teleported there. Vim is a text editor built for that. It lets you edit text at the speed of thought.
Most of our writing time is spent editing
Standard text editors slow you down
When you pay attention to someone writing on a computer for any length of time, you’ll notice that they spend less time actually typing words and more time rearranging or cutting them. Moving around the document takes up the rest of the time. This is actually what makes writing on computers special. Computer programs let you edit or “process” text freely.
To speed up the editing process, these programs have some standard keyboard shortcuts. Everyone knows the shortcut keys for cutting, copying, and pasting text. Then there are keyboard shortcuts for navigating the text on the screen. You can hold down the control key or the option key and tap the arrow keys to jump between words and lines. The special Home and End keys take you to the top and bottom of a document. You can scroll with the up and down arrow keys or use the dedicated Page Up and Page Down keys.
The mouse gets in the way of editing
Vim does what your text editor can’t
For editing actions beyond these few, you’re expected to reach for the mouse. As I’ve said before, switching between the mouse and keyboard slows you down. Anyone who has worked with an Adobe product or even Microsoft Office will agree that keystrokes let you work faster.
Given all that, it’s surprising just how few standard text editing shortcuts exist. I’m not suggesting that we cut the mouse out entirely, people should have the option. The reason being that it becomes one more obstacle in getting what’s in your mind on the screen.
That is precisely what Vim is for. It gives you the freedom to write and edit without lifting your hands off a keyboard.
Vim is a “modal” editor. It operates in different keyboard “modes” or states. There’s an mode meant to execute “commands” or actions for editing and navigating text. This is called Normal, which is the default. When you want to type, you can switch to Insert mode, which lets you use your keyboard like you normally would.
By splitting function and typing into seperate states, Vim lets you write without stopping to pick up a mouse or even lift your fingers off the home row. You can press i while in Normal mode to jump into Insert mode for typing and then press Esc at any time to go back into the Normal command mode.
When you open a text file in Vim or create a new one, it launches in Normal mode. In normal mode, your keyboard does not type characters or letters. Instead, it executes keystroke actions. They’re called Vim motions.
What editing without a mouse feels like
Write at the speed of thought
While in insert mode, if you type gg, the cursor instantly teleports to the first line in the document. You can type capital G to jump to the last line of the fine. Note the line numbers next to each line of the document. You can use them to teleport the cursor instantly to that line number. For example, if I want to jump to line 320. All I have to do is type 320G.
You can scroll normally with h, j, k, and l keys to move the cursor left, down, up, and right, respectively. There are shortcuts for jump between letters, between the beginning and end of lines and words. The braces keys let you jump between paragraphs and sentences. You can move to the middle, bottom, and the top of what you see on the screen too.
There’s even a shortcut that clears everything between quotation marks, drops the cursor right after the first quotation mark, and instantly switches to typing mode.
- Switch options
-
Summer Breeze / Winter Bonfire
- Colorways
-
Gray
- Backlight
-
South-facing RGB LED
- Construction
-
Full CNC machined aluminum
Anyone can learn Vim
Vim has its own grammar
You can type dd to delete the entire line the cursor is currently on. The y key “yanks” or copies text and the p key pastes it.
Notice how these motions tend to stay within the home row, so your hands never leave the row, whether you’re typing or editing. The keystrokes aren’t randomly assigned either. Vim has its own grammar. The d key means delete, c means change, the y key means yank or copy, v means visual, which lets you highlight or select text. The w key is for word, s is for sentence, and p is for paragraph.
The grammar, coupled with the home row advantage, gives you both precision and speed. I’ll share one example to explain what I mean. On a normal writing app, if you want to delete a word, you have to move the cursor to the end of that word and then press the backspace key until it’s erased letter by letter. That means you have to press the backspace key 8 times if it’s an 8-letter word. That’s too much work just to clear a single word. But if you’re on Vim, regardless of which letter the cursor is sitting on in a word. You can just type diw or “delete inside word” and the whole word will instantly be erased without leaving any blank spaces behind. Regardless of how many letters a word has, you only need to press 3 keys, diw, to erase it.
Editing on the keyboard feels like a superpower
It seems like a lot of work to learn an entirely new system of editing just to shave the time wasted dragging a mouse around. There is a serious learning curve with Vim. If you think of it that way, it doesn’t seem like a worthwhile task. However, the time savings are just incidental.
The point is that once you’ve committed Vim workflows to your muscle memory, you will be able to write better. You won’t have to pause your train of thought in order to fix a typo or rewrite a sentence. You would just think, and your hands will do it for you. You could just think about jumping to a particular line, copying the text there, and pasting it at the bottom of the document. And almost instantly, that text would appear at the bottom of the text.
