Why Every Developer Should Learn Vim (2024)

« All Posts

Mastering Vim can unlock endless possibilities for developers. Read on to learn more.

  • By Ben Buurstra
  • Advice

Note: when I’m referring to Vim in this blog post, I’m referring to Vim Motions, not Vim the editor. Vim Motions can be enabled in most integrated development environments (IDEs) and would allow you to gain the benefits of Vim Motions without having to change your IDE. Learning the motions alone is hard enough, so don’t try to learn a new editor simultaneously (unless, of course, you really want to).

Why Every Developer Should Learn Vim (1)

Yup, that’s me. You’re probably wondering how I ended up in this situation…

It all started just a few months ago when I randomly came across an old recording of a live stream by @realGeorgeHotz where he was writing a SLAM (Simultaneous Localization and Mapping) program, and I couldn’t believe how quickly he was writing code and moving through his editor. At that point in time, I had no clue he was using Vim, but it made me realize that I’m pretty slow in comparison, and I’d love to be at that level of speed someday when writing code.

The exact timeline is a bit hazy, but it couldn’t have been more than a week later that I started getting videos by @ThePrimeagenrecommended to me on YouTube, who also seemed to just effortlessly fly through his code and editor. At this point, I knew something was up and came to the realization that these guys knew something I didn’t. After just a few more days of casual viewing, I finally stumbled across a video where @ThePrimeagen started raving about Vim and how effortless and fast text editing becomes once you take the time to learn it.

That was the secret sauce I couldn’t put my finger on, and I was immediately torn. Do I learn Vim, or do I avoid it like the plague? I’ve previously had coworkers on both sides of the Vim discussion; those who used it and swore by it and those who thought there was no way doing everything via your keyboard could possibly compete with the speed and efficiency of using a mouse in an editor, myself included. I went back to the original SLAM video I had watched, and sure enough, George was absolutely using Vim. It was at this moment that I realized I only had one path forward; to buckle down and get ready for the journey of learning Vim.

My Learning Journey

As much as I wish I could say, “After an hour or so, you’ll be up to speed and cruising along at the same pace as with a mouse, and after a full day, you’ll be flying around your editor like @ThePrimeagen and @realGeorgeHotz,” that’s about as far from reality as you can get.

Learning Vim is a process, and that process takes weeks of dedicated time (or months of dabbling) just to get up to the same speed as with a mouse. It’s probably one of the steepest learning curves of anything I’ve ever learned, but the payoff of learning it is extremely valuable, in my opinion.

The Mental Gymnastics

Why Every Developer Should Learn Vim (2)

The main reason for the extremely slow process of learning Vim is down to the sheer amount of mental gymnastics you have to go through just to move the cursor where you want it, copy text, paste text, etc., and it takes an extremely long time for those common actions to feel remotely close to muscle memory. I’ve been on this learning journey for nearly four months as of writing this, and to this day, I’m still having to recite the actions I want to take in my head as I’m performing them.

“Alright, down four lines, (4j), yank the line (yy), up 16 lines (16k), select the current line (V), paste over it (p).”

I look forward to the day when all of that becomes second nature because that’s when I’ll really start to fly with Vim.

The Endless Possibilities

Why Every Developer Should Learn Vim (3)

Another challenge of learning Vim (which also happens to draw some parallels to learning development) is the seemingly endless methods of accomplishing whatever it is you’re attempting to do.

Let’s say you want to change the parameters of the TryParse method in the example below with your cursor starting at the beginning of the line:

if (int.TryParse(role, out var roleId)){…}

If you’re new to Vim and don’t know many of the advanced motions yet, your initial thought would probably be to repeatedly press ‘w’ until you’re at the start of the word ‘role’, enter visual mode with ‘v’, repeatedly press ‘e’ until you’re at the end of the word ‘roleId’, press ‘d’ to delete what’s currently selected, then press ‘i’ to enter insert mode and start typing the replacement.

Why Every Developer Should Learn Vim (4)

If that sounds like a lot, that’s because it is… and that approach is guaranteed to be slower than just using your mouse to make the same selection, press backspace, and then start typing the replacement. But when you’re first starting out, that’s all you know, so that’s really your only option as you don’t yet know a better way to approach it. (which is totally okay! You need to learn the basics before you start learning the more advanced stuff. You must learn to crawl before you can walk.)

With my current knowledge of Vim, if I were trying to do the same, I would first press ‘f’, followed by ‘(‘, which would find the first ‘(‘ in the line. I’d then press ‘;’ to go to the next instance of that character, this time landing on the opening parenthesis of the TryParse method call. I’d then use ‘ci(‘ to “change inside the parentheses”. This removes the text within the parenthesis I’m currently on (or in between) and puts me into insert mode immediately.

Why Every Developer Should Learn Vim (5)

That approach is much better and is just as fast, if not faster, than trying to do the same with clicking and dragging with my mouse. In this specific case, I could likely be even faster by finding the ‘,’ character as that’s faster than finding the first ‘(‘ and having to navigate to the next one. So, with that improved approach, the full combination of keys would end up being ‘f,ci(‘, which takes no time at all to execute.

The best advice I can give with regard to the difference in approaches above is to try not to get tripped up on finding the absolute optimal approach, especially when you’re first learning. Be okay with a non-optimal approach that takes more time because you have to learn the basics no matter what. As time goes on and you get more comfortable with Vim, you can start looking into alternative approaches to performing certain actions. I find myself constantly doing things a certain way, then all of a sudden coming to the realization that there’s a better way to do whatever it was I just did. I’ll quickly undo my edits (using the ‘u’ key) and try the alternative approach I just thought of. If it feels better, I make a mental note to try and use that approach in the future when trying to accomplish that same thing again or something similar to it.

If you’d like to know where I learned most of what I know up until now, I heavily leaned on this playlist on YouTube by @ThePrimeagen.

Benefits of Learning Vim

I know there’s been a few nuggets of information that point to some of the benefits of Vim in the section above, but I’d like to do a deeper dive into some of them and also share some additional benefits I haven’t covered yet.

Speed

Why Every Developer Should Learn Vim (7)

This benefit has already been touched on above, but I still believe it’s worth calling out in this section since it is definitely the main benefit of learning Vim. Anything that can make you a faster developer should be a no-brainer. As previously mentioned, you will be much slower when you first start. This is the most painful part of learning Vim, but once you’re equally as fast with Vim as you are with a mouse, you will have crossed the threshold of gaining all the additional benefits outlined below with the additional upside of having the ability to continually get faster and faster as time goes on.

Health Benefits

Why Every Developer Should Learn Vim (8)

This may seem like a strange benefit, but switching between your keyboard and mouse less frequently can have a large impact on reducing your risk of developing an RSI (Repetitive Strain Injury). Every time you have to move your hand from your keyboard to your mouse, you’re putting strain on your wrist, elbow, and shoulder. The more times in a day you’re performing this action, the higher your risk for RSI’s.

If you’re still using your existing IDE when learning Vim, it’s likely you’ll still be using your mouse to navigate within your IDE. But reducing the risk of RSI’s can be further enhanced by switching to a Vim-based editor (see “Adoption of ‘better’ IDE’s” below)

Portability

Why Every Developer Should Learn Vim (9)

This might be a bit more of a niche benefit, but this was definitely a big one for me. As someone who works on a Windows machine at work and has a macOS machine at home for personal projects, I would constantly get tripped up on Ctrl vs. Command when copying/pasting and all the differences in cursor movement between the two operating systems (Ctrl + arrows in Windows are the same as Option + arrows in macOS when moving the cursor in text files).

All this mental overhead went away once I was using Vim on both machines. Need to copy text? Just use ‘y’. Need to paste? Just use ‘p’. Need to undo? Just use ‘u’. Need to move the cursor word by word? Just use ‘w’.

You could make the argument that I just traded the mental overhead of switching between systems for the overhead of using Vim, but the beauty of Vim is that once it’s learned, the mental overhead disappears. If I had stuck with my old approach, the mental overhead would still exist every time I switch systems until the end of time.

Another small but still impactful benefit that fits within the portability benefit is the ability to edit things like config files directly on servers that you’re accessing via SSH. With Vim, you can quickly navigate and edit files when working in a GUI-less environment.

Adoption of “better” IDE’s

Why Every Developer Should Learn Vim (10)

This section is extremely subjective since the best IDE for you is always going to be the one you’re most comfortable using, but there’s no harm in stepping outside your comfort zone and seeing what else might be available to you.

If I had to guess, most developers reading this are using VS Code as it has more or less become the industry standard for web development due to its extensibility afforded by their extension ecosystem. I, too, still use VS Code when writing code on Windows machines, as the Vim extension does a great job of giving me 90% of what I’m looking for. The remaining 10% is down to limitations I’ve found when it comes to navigating the IDE itself (I’m sure it’s possible to fix most, if not all, of the limitations I’ve experienced, but I haven’t taken the time to figure out how yet).

If you’re someone who loves tinkering and wants to really dive deep into making an IDE that’s tailored to your specific wants and desires, I’d recommend looking into NeoVim. I’d also recommend holding off until you’ve got the basics of Vim down before doing so. Otherwise, you’ll be trying to learn two things simultaneously, adding additional complexity.

I ended up making my own NeoVim configuration based on a handful of tutorials I watched on the topic, and I’ve found I much prefer working in my custom IDE than I do working in VS Code, but it could also be down to some additional tooling that I use that isn’t available on Windows. My current setup on my personal macOS machine consists of using my custom NeoVim editor in conjunction with tmux, which is a terminal multiplexer. This allows me to easily switch between multiple instances of NeoVim, all individually configured for the needs of each project. This makes it super easy to jump between projects and pick up wherever I had last left off and also allows each project to be set up exactly how I like it. I even have some tmux plugins set up to handle saving the state of my sessions so that after a system reboot, all my sessions are exactly how they were before the restart.

It’s also super easy to “package up” your configuration, so it’s super fast and easy to get spun up on a new machine. In my case, my tmux and NeoVim configuration files are in a repository on my GitHub, so whenever I set up a new machine, I just install NeoVim and tmux, clone my repo, create symlinks to the root of my user for the tmux and NeoVim configuration files and directories, and I’m good to go. Everything is set up exactly how I previously had it, and it took less than a few minutes. It also allows me to make updates on any of my machines, push those changes to my repo, and then pull those changes on any other machines. Because of the symlinks, those changes are applied to my system as soon as I perform a pull operation.

The biggest benefit of NeoVim and tmux, in my opinion, is that I’m able to navigate every aspect of my editor via my keyboard. This makes my development experience a dream, as all my coding can take place without ever needing to move my hands off my keyboard. It also makes it really enjoyable to work on just my laptop when I’m on the go, as I don’t need to constantly reach for the trackpad when navigating my IDE.

Conclusion

My hope is that this blog post has at least made you consider trying out Vim at some point, even if you’ve previously sworn off the idea of ever giving it a chance. I was in that position not too long ago, and I can tell you from experience that as long as you stick with it and give it a fair chance, you might be surprised at how beneficial it is to learn Vim. While the path to mastering Vim may seem daunting, the endless possibilities it offers in terms of speed, health benefits, and adaptability make it a skill worth acquiring. The worst that can happen is you find out you don’t like it!

About the Author

Why Every Developer Should Learn Vim (11)

Ben Buurstra

Ben has always loved technology and computers but was a bit of a late bloomer when it comes to coding. He wrote his first line of code during his freshman year of college, afterward, he became completely hooked. After just one semester, Ben was working as a programming tutor for his college and doing tons of web development projects. When Ben isn’t working on a side project you’ll find him spending time with his wife and their dog, or playing video games with friends.

View Full Bio

Why Every Developer Should Learn Vim (2024)

FAQs

Why Every Developer Should Learn Vim? ›

Efficiency. One of the primary reasons developers should consider learning Vim is its exceptional efficiency in text editing tasks. Vim's modal editing system, extensive keyboard shortcuts, and powerful text manipulation commands allow users to perform complex editing operations with speed and precision.

Why every software engineer should use Vim? ›

We have learned that Vim is a powerful text editor popular among developers. It's 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.

Why is learning Vim important? ›

Benefits of Using Vim. Speed and Efficiency: Vim is designed to be an efficient text editor. Its modal editing and commands can help you work faster and more efficiently. You can use shortcuts and commands to perform complex operations with fewer keystrokes.

Is there a point in learning Vim? ›

Learning Vim is a process, and that process takes weeks of dedicated time (or months of dabbling) just to get up to the same speed as with a mouse. It's probably one of the steepest learning curves of anything I've ever learned, but the payoff of learning it is extremely valuable, in my opinion.

Why do competitive programmers use Vim? ›

Many people ask for the best text editor for the programming contest. So, according to me vim is a great tool for competitive programming. It is not very comfortable to use it at first but after some time you will feel it is the best text editor ever made.

Why do people use Vim instead of IDE? ›

Understanding the Underlying Processes: While IDEs provide powerful debugging and automation features, they often abstract away the intricate details of program execution. Vim, being a lightweight text editor, encourages a deeper understanding of the underlying processes.

Why should I use Vim instead of Vscode? ›

This is another area where Vim shines. Vim runs in the terminal and can be used in any environment, whether a GUI is present or not. Vim has the same keybinding set across all operating systems, unlike Vscode, which has different shortcuts for Linux, Mac, and Windows. So with Vim, you learn once and use it everywhere.

Why do people use Vim still? ›

Knowing how to use vim may not be the most essential part of being a developer. However, knowing and using it increases your productivity and you can write a lot of code in a very short time. You can use Vim in mostly every modern Text Editor/IDE: IdeaVim in all JetBrains products.

Is Vim a good skill? ›

Having at least a basic functional knowledge of VIM is good because it can often be the default editor for new computers or a coworker's computer. It's not something that I would bother putting a lot of work into or including on a resume.

Why should I switch to Vim? ›

The advantage of vim is that you can quickly edit files from command line and has very advanced text processing capabilities. But again, a good IDE can do all this.

What is the importance of Vim? ›

Vim keybindings are important because they allow you to edit text with a precision and speed that traditional editors struggle to match. The efficiency gains from Vim's keybindings translate into saved time and enhanced productivity.

What is the best tool to learn Vim? ›

Learn keybindings using Vimtutor

For getting to grips with the keybindings I highly recommend using Vimtutor – Vim's inbuilt tutorial. The vimtutor can be accessed by simply typing Vimtutor into your terminal (if vim has already successfully been installed).

What is the disadvantage of Vim? ›

Here are some disadvantages of using Vim as an IDE: Steep learning curve: Vim has a steep learning curve, especially for beginners.

What is the point of Vim? ›

Vim is a text editor for Unix that comes with Linux, BSD, and macOS. It is known to be fast and powerful, partly because it is a small program that can run in a terminal (although it has a graphical interface). It is mainly because it can be managed entirely without menus or a mouse with a keyboard.

Why is Vim difficult? ›

Why is it so hard to learn vim and stick to it, well meanly because of vims steep learning curve which is different than most other stuff you try to learn. To learn vim, you need to create muscle memory, do not try to memorize every single command the first day, it is impossible.

Why is Vim the best text editor? ›

There are several reasons for this: Its power: Vim users benefit from powerful search and replace functions. Its features: for example, automatic completion, file comparison, advanced searches, command line history, online help, spell checking, block operations, scripting language, etc.

Do most programmers use Vim? ›

If we look at the StackOverflow survey for 2019 about the most popular development environments, Vim is still there on the 5th place, with around 25% of Web Developers using it.

Why use vi instead of Vim? ›

For simple text editing tasks, both vi and vim will behave similarly. However, vi is preferred because we can expect it to be on POSIX compliant (or at least mostly compliant) systems. Moreover, regarding the performance, vim requires a little more resources than vi due to its more extensive features.

Top Articles
Fifty Pence 1969-1997 Large Sized | Check Your Change
Bad Credit Causes
Star Wars Mongol Heleer
Skyward Houston County
Time in Baltimore, Maryland, United States now
Nfr Daysheet
Mr Tire Prince Frederick Md 20678
Kobold Beast Tribe Guide and Rewards
Erskine Plus Portal
Yi Asian Chinese Union
B67 Bus Time
Danielle Longet
Wunderground Huntington Beach
Bjork & Zhulkie Funeral Home Obituaries
Animal Eye Clinic Huntersville Nc
Walmart Windshield Wiper Blades
Stihl Km 131 R Parts Diagram
2016 Ford Fusion Belt Diagram
Interactive Maps: States where guns are sold online most
Mals Crazy Crab
Convert 2024.33 Usd
Grayling Purnell Net Worth
Bank Of America Financial Center Irvington Photos
Hobby Stores Near Me Now
O'Reilly Auto Parts - Mathis, TX - Nextdoor
Universal Stone Llc - Slab Warehouse & Fabrication
Sound Of Freedom Showtimes Near Movie Tavern Brookfield Square
Safeway Aciu
Phoenixdabarbie
Lilpeachbutt69 Stephanie Chavez
LG UN90 65" 4K Smart UHD TV - 65UN9000AUJ | LG CA
Stubhub Elton John Dodger Stadium
Ultra Clear Epoxy Instructions
Kips Sunshine Kwik Lube
Ippa 番号
Edict Of Force Poe
Td Ameritrade Learning Center
Seminary.churchofjesuschrist.org
Emily Browning Fansite
COVID-19/Coronavirus Assistance Programs | FindHelp.org
13 Fun & Best Things to Do in Hurricane, Utah
Citibank Branch Locations In North Carolina
Chase Bank Zip Code
Poe Self Chill
What Is The Optavia Diet—And How Does It Work?
My Gsu Portal
Zom 100 Mbti
Random Warzone 2 Loadout Generator
Wild Fork Foods Login
18443168434
Autozone Battery Hold Down
How To Find Reliable Health Information Online
Latest Posts
Article information

Author: Kerri Lueilwitz

Last Updated:

Views: 6665

Rating: 4.7 / 5 (47 voted)

Reviews: 94% of readers found this page helpful

Author information

Name: Kerri Lueilwitz

Birthday: 1992-10-31

Address: Suite 878 3699 Chantelle Roads, Colebury, NC 68599

Phone: +6111989609516

Job: Chief Farming Manager

Hobby: Mycology, Stone skipping, Dowsing, Whittling, Taxidermy, Sand art, Roller skating

Introduction: My name is Kerri Lueilwitz, I am a courageous, gentle, quaint, thankful, outstanding, brave, vast person who loves writing and wants to share my knowledge and understanding with you.