Vim users have distinct habits. Why? Because Vim is a complex tool that can be customized to fit the user’s needs. Here are 10 things I do in Vim along with an explanation of what each one means.
1. Use splits – Since Vim windows and tabs are just views into buffers, they allow you to look at multiple buffers at once. This is more powerful than using tabs because it allows you to view multiple files at once.
2. Use marks – There are many ways to get around in Vim, but there are some instances where you need to jump back and forth between specific places in the codebase. Marks allow you to create bookmarks for specific locations so when you need to jump back, you can quickly get back without having to guess or remember exactly where you were before.
3. Use registers – Registers allow you to copy and paste text from arbitrary locations — even locations outside of Vim — and pasting them is as easy as typing “*p” (where * is the register). I use this all the time when I’m debugging something or working on a bug fix: often times, the fix will be very similar to the error message from my test or console output from my local web server.
4. Write custom commands
This is a blog about the habits of Vim users. It’s also about why people use Vim in the first place.
I’ll start this blog with a story about my friend. He was a die-hard Vim user. He was proud of it and he flaunted it in our faces. At one point, a laptop that had Vim on it was actually stolen from him. Upon stealing the laptop, the robber assumed he’d find some valuable information in it, but all he found was his vimrc file along with his extensive customizations to it.
We’ll never know what happened to that poor guy who stole my friend’s laptop, but we can all learn something from his experience. And, if you’re here, I assume you are interested in learning more about Vim users, their habits and why they use it in the first place.
1. We don’t use our mouse or arrow keys.
2. We learn the language of Vim.
3. We always know where we are in the file and what we’re doing.
4. We never stop moving in the text.
5. We use registers as a staging area for copy and paste operations.
6. We run commands on blocks of text without plugins like EasyMotion or multiple cursors, using Vim’s built-in tools like f, t, F, T, v, V, ci”, ci’, yi”.
7. We often work with language files that don’t have syntax highlighting set up for them (e.g.: vim some_file).
8. We write code faster than our coworkers think is humanly possible and then they get mad at us for showing off (this isn’t intentional; we just can’t help it).
9. Our .vimrc files are something we’re proud of and love to show off (even if everyone else reading it has no clue what any of it does).
10. We know that Vim is not modal editing; it’s modal everything!
1. Vim is a skill you need to learn and re-learn
2. Vim users are always learning new ways to accomplish the same thing
3. Vim users are constantly on the lookout for “the one true” way to do things
4. Vim users will never forget the first time they used vim
5. Vim users will use vim no matter what kind of computer they have
6. Vim users will not use the mouse when vim works just fine
7. Vim users will spend more time configuring their tools than using them
8. Vim users cannot read plain text without thinking about how they would edit it with vim
9. Vim users are good at making friends with computers, but bad at making friends with people ????
10. Vim users love a challenge
All vim users know their keyboard shortcuts. It’s how they get things done quickly and efficiently. As a vim user, you probably use your keyboard shortcuts without thinking about it. Here are some of the most common ones:
h j k l – Move around in vim like a pro.
dd – Delete a line of text.
yy – Yank (copy) a line of text.
p – Paste the last thing you yanked or deleted below your current position.
Shift + P – Paste the last thing you yanked or deleted above your current position.
u – Undo your last change.
Ctrl + R – Redo your last change (that you undid).
:wq or ZZ – Save and quit the document you’re working on (ZZ is just easier to type than :wq). Writing these two key sequences can be a habit as well, so we’ll cover them both here.
1. They use the hjkl keys to move the cursor. This is the most easily recognizable and known of Vim’s keybinds. The hjkl keys are used for moving the cursor in Vim because it is an easy keyboard layout that does not require any finger movement; your fingers always stay on the home row.
2. They save their work by typing :w**
3. They quit a file with :q**
4. They write and quit with :wq**
5. They write, quit, and close their editor with :wq!**
6. They open a new line with o or O**
7. They delete a word with dw**
8. They change a word with cw**
9. They copy a line with yy (yank) or p (paste)**
10. They close their editor with ZZ (capital Z-Z)
1. You don’t use your arrow keys.
2. You don’t type the same thing over and over again.
3. You can’t live without hjkl.
4. You like to write in Vim, but you know the editor isn’t perfect*.
5. You live in a modal world, but you don’t always have to use modes.
6. You know what plugins are — and that you can live without them**.
7. You know there are thousands of other things you could learn about Vim, but you stop when you know enough to be productive**.
8. You’ve heard of Emacs and Sublime Text, but they don’t matter to you… much**.
9. You use Vim inside iTerm2 or tmux (or both).
10: It just works, so you can focus on what matters to you**