DEV Community

loading...
Cover image for Why Vim is the best editor

Why Vim is the best editor

tomburgs profile image Toms Burgmanis ・3 min read

I've been seeing articles from people claiming that VSCode is the best editor, so I'm here to tell you why they're wrong.

That first line

Since I wrote my first line of code a surprisingly long time has passed, and a lot has changed in the development world, but surprisingly little has changed in the code text editor world.

I've used about every mainstream code text editor.

I started with Notepad++, proceeded to Sublime which was my main editor for years, then Atom, briefly PHPStorm, eventually VSCode and finally Vim.

After all that, I can confidently say that I've never been as happy with any other editor as I've been with Vim.

Why I made the switch

It's easy to ask why anyone would make the switch, after all most people consider editors such as VSCode good enough for their needs and so did I.

But it was already a pretty weird in the code editor space.

Most people I was working with were using one of the modern fancy text editors, but people within the developer communities who I was following were almost all exclusively using Vim.

An odd anomaly I thought, but I never dwelled on it.

It is what it is

Well, one day I was watching George Hotz's live stream, I don't remember what he was working on, but it was interesting enough for me to sit through it.

In this livestream he was using the Vim editor and I was completely blown away by how quickly he managed to make changes.

He had already managed to make multiple changes to the file, saved it, and re-compiled the program before I even understood what he did.

If I could be just half as productive I would already be happy.

Vim Strong

Research before you commit

Before I committed to this change, I had first done some research and I could only find good things people had to say about Vim.

Many people described it as being able to write code at the speed of their thought, or Vim being an "extension of their fingers".

So, I got into it, knowing I'll be dreadfully slow at first, but hoping that some day I'll be amazing at it.

Journey into Vim

It was unlike any other editor I had used before.

Compared to Vim everything I had used before was just a text editor with pretty syntax highlighting.

Facepalm

The productivity is great

Vim can do wonders with just a few keystrokes, which tends to be the main reason people love it.

Only after a week of using Vim I was already at the same speed I was with regular editors, and after that I just got faster.

I now occasionally manage to wow people when using it, which always feels great.

It's also quite addictive to constantly try to find a quicker way to do things, it almost feels like a video game at times.

VSCode ain't got nothing on Vim

I was concerned at first that I'll be missing out on some of the useful plugins I had in VSCode, but those concerns were completely unwarranted.

The Vim community has developed a plugin for every language and its needs, which in many cases works far more seamlessly than the ones for VSCode or other editors.

Should you switch?

I advise you to do your own research, but in general I see no reason not to, however, do keep in mind that you're ultimately learning a programming language, so you need to stick with it to learn it.

If programming is something you take seriously, then learning Vim is invaluable. However, if you just want to do your 8 hours and go home, it's probably not worth it for you.

Do or do not

Community help

I was recently introduced to an MIT lecture talking about Vim's philosophy and some of the basic features, so if you're interested in learning Vim, check it out here.

I've also created a community discord server for Vim, so if you're a Vim user, please feel free to join by going here.

Vim Golf anyone?

Conclusion

I hope you found this article interesting!

Feel free to start editor war v2 in the comments.

Happy Vimming 🧙.

Discussion (29)

pic
Editor guide
Collapse
cipharius profile image
Valts Liepiņš

Vi binding model truly is eye opening!

Biggest problem with vi-like bindings is that you'll start despising everything that is not modal. :)

Also it might be worth checking out NeoVim which is rewrite of vim engine, but further improves plugin support and is flexible enough to create new frontends for it.

Collapse
tomburgs profile image
Toms Burgmanis Author

Agreed, Nvim is fantastic and what I myself primarily use. :)
The fundamentals are still very much the same however.

Collapse
lucastrvsn profile image
Lucas Trevisan

I was addicted to vscode and I made switch to neovim. Omg, at first it was just pain. I reach the mouse and the arrow keys all the time, but in one or two weeks later when I try to type something to vscode I realised why vim is so awesome. Vscode feels like a pain, stressful and weird. I was complete, now with neovim lsp and treesitter I'm happy and I like to just open vim to type random things and being grateful for my choice. Vim is the best editor ever made and nothing will take that place. Why I need to reach my mouse to click when I can just move to that location with my keyboard? Why I have to have this bloated interfaces to just write my code? Why I need a keyboard with arrow keys after all? Now I have my own custom keyboard with just the thing I need: the letters and the numbers. Thanks to vim and all of the maintainers that keep pushing vim to something I love.

Collapse
raddevus profile image
raddevus

That's what I thought -- from the little bit I've used Vim -- is that the increased productivity is from the focus on keeping your hands on the keyboard. Switching to the mouse causes mental switches too and can move you out of your thoughts. I agree with you.

Collapse
raddevus profile image
raddevus

I think maybe the benefits you are seeing is because you can do everything from the keyboard, right?

The point being that you don't have to move your hand over to the mouse and mess up your flow of typing. But I wasn't sure from your article what the advantages of Vi/Vim really were. The mouse gets in the way really, because you always have to move a hand over to it and most "modern editors" require a lot of mousing. If that's what you're saying, I definitely agree.

Collapse
tomburgs profile image
Toms Burgmanis Author

Sure, mouse is a factor, but it’s not the main factor.

Vim is a language, and the main benefits come from the ability to quickly summon & combine commands that help write / modify code.

So, yes, using the mouse in Vim is ineffective, but you don’t have to use mouse in VSCode either, you would just look ridiculous if you don’t.

Collapse
raddevus profile image
raddevus

Ok, I'm not sure how one editor can be faster than another then. I guess it is all about macros or something then? You mentioned that the person you watched in a video was super fast at editing code but why was that? Macros that typed things and removed code for him? What is the main benefit from Vim over VSCode or some other editor?

Collapse
richardj profile image
R☭

I have been using VIM for years now and tend to expand my knowledge with it constantly, but i have found that for comparing things in multiple files or quickly opening files is not as fast as i want it to be (opening file search with :Vex).

Does anyone have some tips on how to improve on that?

Collapse
eljayadobe profile image
Eljay-Adobe

I've been using vim for over 20 years. Before that I used emacs or ced (CygnusEd, on the Amiga) or Brief (by Underware) or a few others that I no longer can recall.

I made the switch from emacs to vim on a bet / dare. My coworker used emacs for a month, I used vim for a month. After the month was up, he went back to vim immediately, and I didn't go back to emacs.

I appreciate that with vim the editor and keyboard gets out of my way and I have a zen-like experience of becoming one with what I'm editing.

Collapse
ug02fast profile image
Arthur Zhuk

geohot doesn't even use vim effectively, he's bruteforcing a lot. I like vanilla vim but VSCode has better TypeScript support than any vim plugin.

Collapse
tomburgs profile image
Toms Burgmanis Author

What plugins have you tried?

Have you tried COC (Conquer of Completion)?

I’ve been using it for a while, and it works really well for me.

Collapse
ug02fast profile image
Arthur Zhuk

Yeah, it's not quite as feature-complete as using VSCode when it comes to TS.

Collapse
lucastrvsn profile image
Lucas Trevisan • Edited

neovim lsp is awesome and I did not miss vscode at all

but it's microsoft fault: github.com/microsoft/TypeScript/is...

Collapse
ug02fast profile image
Arthur Zhuk

i spent many hours over days getting lsp solution on par with vscode's and it just isn't there. one small benefit of having corporate funding in situations like this.

Thread Thread
lucastrvsn profile image
Lucas Trevisan

Yes, they created typescript and not provide the full capabilities of the tsserver for lsp standards. They promised to full integrate all ts into tsserver.. we'll know soon

Thread Thread
ug02fast profile image
Arthur Zhuk

How often do promises in the context of features happen. Sure sometimes but lots of times they don't. If there is a monetary incentive for Microsoft to maintain tsserver capabilities for lsp then I would believe it. As I see it they want VSCode to be the goto editor probably to get devs on their suite of services.

Collapse
victoredier profile image
Victor Edier

%insert_exit_vim_joke_here%

Collapse
richardj profile image
R☭

Luckily i have created a solution for that, it's on github:

github.com/richardj/wq

Collapse
yokowasis profile image
Wasis Haryo Sasoko • Edited

My only complain for VIM compared to most modern editor is the ability to multi select (a.k.a) Ctrl+D.

Sure VIM has plugin for that, but it's painfully slow.

Another lovely features is integrated debugger, markdown / html preview, csv editor, also since now GITHUB is owned by Microsoft, Cloud Save to github, and able to create a new repo right from the editor.

VSCode might be started as a code editor, but now clearly it's on its way to become an IDE.

For an editor, VIM maybe better than VSCode.

Collapse
ranelpadon profile image
ranelpadon

Vim has no concept of multi-cursor really, but the visual mode and macros could achieve the same thing, and probably even better for complex cases.

Collapse
rolfstreefkerk profile image
Rolf Streefkerk

"I now occasionally manage to wow people when using it, which always feels great."

If that's an important metric, I guess switching could make sense. For me a lot of coding is not just typing in stuff, I need the integrations and the debugging tools with the environments I use to be really productive. If a tool requires me to learn too many shortcuts on my keyboard, it just gets in the way.

Collapse
ionutarhire profile image
Arhire Ionut • Edited

I think you have the option of using vim like shortcuts in vscode. I don't know if it's comparable to using vim itself so maybe someone can enlighten me on it.

Collapse
lucastrvsn profile image
Lucas Trevisan

I tried to use vscode with VSCodeVim and Neovim extension, but nothing will ever compare to the vanilla terminal vim. Because vim is a unopinated text editor and we can just "extend ourself" to it.

Collapse
ionutarhire profile image
Arhire Ionut

I don't really understand. In what way is it unopinionated and what do you mean by "extending yourself" to it?

Collapse
tomburgs profile image
Toms Burgmanis Author

Shortcuts themselves would not cut it, as Vim is far more than just shortcuts.

There is a Vim emulator plugin for VSCode, but in my opinion it doesn’t really compare to actual Vim experience.

Collapse
ionutarhire profile image
Arhire Ionut

I didn't know that. Sounds vague but I'm intrigued anyway. Thanks.

Collapse
braydentw profile image
Brayden W ⚡️

I’ve always wanted to learn Vim, but didn’t know if it was right for me...

Thanks to your article, I guess I’ll have to give it a try ;)

Collapse
hugertown profile image
Hugertown

It didn't really work for me, so I'm looking for other options. Maybe who knows?

Collapse
qasius profile image
Qasius

I've already picked up different video editors. Since I often produce video clips I need the rendering to be very fast, in addition, so that then there were no problems with the quality of the video, as many editors really cut it. While I found the most balanced version of this link , he has a fairly quick renderer and in the presence of many handy for editing plugins and they do not have to look for a long time as Premiere. So far I do editing with it.