DEV Community

Sergey Kislyakov
Sergey Kislyakov

Posted on

Should I learn Vim (or its keybindings)?

I wonder does Vim really boosts up your productivity. My IDE has the keybindings so I wonder should I give it a shot or not.

Latest comments (25)

Collapse
 
svnset profile image
Robin L. • Edited

Well there may be good vim plugins like those from Jetbrains, but in my opinion they always fall short in some way.

Also I could imagine it is kind of hard to learn vim or beeing motivated to learn it without using it natively.

As someone who uses vim (nvim nowadays) for everything, I'd also like to add that this huge productivity boost many people have in mind when talking about vim is an illusion. There is always the right tool for the right job and most of the time it depends firstly on your skills and secondly on the tools you use. Using vim is in my opinion more than just using some editor. It's a way of thinking (modularity!) and if it fits in your environment (but only then) so that you end up spending alot of time in vim, productivity can be increased alot yes. It suits people the best who spend most of their time in the terminal and have their ecosystem of small modular programs set (eg. vim, fzf, rg, tmux/nvr, ranger, glances, fish...) which they love and use everyday.

I say this because I bet you have a workflow already and it could take months or more to be at the same level you are right now. Well enough demotivation for now. Motivating you to use vim is easy. It is by far the best editor I came across and if you somehow manage to survive the first few months in vim with all the getting started issues (learn text objects!!!) you will never look back :)

Collapse
 
defman profile image
Sergey Kislyakov

Well I'm a vim user now. Wasn't that hard to learn it. I suffered a lot when switched from qwerty to dvorak so I'm not scared of re-learning keys anymore ;)

Collapse
 
svnset profile image
Robin L.

You say that as if we stop learning new stuff in vim at some point. We'll never do don't get fooled :P But I am happy for everyone who makes this step and I should've not written this post literally seconds ago... Welcome to the family :)

Collapse
 
mbrochh profile image
Martin Brochhaus

Definitely yes. Do it.

I used to have a lot of pain in my wrists when I was still using a mouse and didn't use vim. Once I started using vim, I got more shit done but the pain has vanished (that was 9 years ago).

It doesn't even take much time to learn it. Three or four days after running through vimtutor, you should be up to speed, the rest comes as you go. You will be like "Hmmm... I wonder if I can jump to the top of the file?" Quick google, quick "AHA!" moment.

I used to have a heavily customized vim config, but nowadays I'm just using the vim bindings in atom.io and I haven't even added any custom bindings. The defaults are already sane and powerful enough.

Collapse
 
craser profile image
Chris Raser

First, if you're looking for productivity, the following are all much larger factors than your IDE/editor:

  • Uninterrupted blocks of time to work in (allows concentration)
  • Automated testing (supports debugging, refactoring, onboarding...)
  • Clear communication of team & individual goals (ensures that you're doing the right thing, because "Doing the right thing adequately trumps doing the wrong thing beautifully.")

So if you're trying to prioritize what to learn/change, you might be better off building your testing speed/skills than learning a new editor. If those are all in place, then by all means look for a better IDE/editor.

I've used various IDEs & editors, and the "productivity" isn't a product of keybindings, but rather a of features that let you think and act over bigger "chunks" of code.

I love IntelliJ's refactoring functions (extract function, extract parent class, create/goto test, etc.), and I love that IntelliJ (and WebStorm) let me rebind keys, or just hit Shift-Cmd-A and type the name of the command I want to invoke.

So, I totally agree that good key bindings are important. But you'll get more of a productivity boost by delegating more work to your tools, and having fast ways to accomplish that delegation. Pick your IDE/editor for the features, then configure the keybindings to suit you.

Cheers, and let us all know what you find!

Collapse
 
fengshangwuqi profile image
枫上雾棋

I have not changed when I use vim coding, there is a repositorie to-vim-tmux-zsh maybe you can have a reference.

Collapse
 
jaysoifer profile image
Jonathan Soifer

Apparently many people already talked about how the productivity factor is actually related not only to keybindings but also modal editing.

That being said, one of the things I enjoy the most about Vim is the amount of memory required by it and its start up time.

A well configured Vim is instantly available and uses almost no memory at all. It is cheap to start and quit, in all senses.

Not only that but if you’re also doing Ops (or DevOps for that matter) and you need to ssh to a server... vim is pretty much always available and ready.

So the answer is Yes. Vim does boost our productivity but, as with anything in life, there’s a learning curve that doesn’t necessarily make sense to everyone, specially to those new to the industry*.

  • Why? Because when you’re already trying to understand how a http request works or why do we need so many package managers and all those build tools, worrying about keyboard shortcut will only make it worse.

I love Vim. I used it pretty much everyday, either by itself or inside of Emacs (Spacemacs) which is my main editor today.

Collapse
 
niorad profile image
Antonio Radovcic

Yes it does.

Not having to reach for the arrow-keys is one of the big advantages.

And I can't code without things like ci" (delete contents of quotes and place cursor between them. also works for <> {} '' etc.) or "dit" (delete contents of Tag).

The cool thing is, that there are VIM-plugins for all popular editors/IDEs. They are mostly a compromise, and some are better (EVIL, Sublime's Vintage), some are worse (IntelliJ), but you'll be more productive nonetheless.

But it will take some time. Use VIM for a couple of weeks, do the VIM-Tutorial, disable your arrow-keys and look up commands if you find that you are repeating certain actions (theres always a shorter way).

Collapse
 
5n4p_ profile image
Andreas Schnapp • Edited

I have started learning how to use vim the right way by reading "Practical Vim" by Drew Neil. I really enjoyed the reading and it changes the way of thinking while editing text completly.

While I always love coding it's even more fun by editing the vim way (ok most tasks i'm using a IDE with vim mode).

But there was also some tasks which feels like hard work. Where you have to edit many places and do some boring but error prone changes multiple times.

Today I love having the same situation. I make the change one time in a very clear and reproducable vim movements/commands sequence. And then I can easily do the "hard work" by using the first sequence multiple times as a macro.

It take some time to master vim but for me it was quite fun and i'm love to find new ways of beeing more productive every day.

Collapse
 
mortoray profile image
edA‑qa mort‑ora‑y

I use vim for small things in the console, or when over a network connection. Beyond a few basic commands I don't know much, and would never use it for more than minor changes. It also tends to pop up for some git commands.

Minimal commands I use frequently:

  • i to edit a document
  • ESC to get to non-edit mode
  • dd to delete a line
  • d + down_arrown to delete a couple of lines
  • ESC to enter commands
  • :w to save the file
  • :q to quit, and q! to quit without saving
  • :m-2 to move a line up one, useful for reording git commits
Collapse
 
argherna profile image
Andy Gherna

Vim is a tool like grep awk or Python. The question I think should be asked is what do I gain from learning it.

Collapse
 
argherna profile image
Andy Gherna

That said, my .vimrc file dates back to Aug 2000 so I may be what you’d call “old and grizzled”. I took a few years off from vim to see what I was missing in emacs which is also good. It comes down to athe question of what is the right tool for the job to me. Sometimes it’s vim. And sometimes it’s emacs. And again sometimes it’s something entirely different.

Collapse
 
eduardort profile image
Eduardo Reyes

It really isn't about the keybindings, it's more about the modal editing. If you learn vim like a mindset it's gonna be much much better (the keybindings are a big part of vim though)

Collapse
 
bobcoggeshall profile image
Bob Coggeshall • Edited

I learned VI around 35 years ago. Yes, you will need to spend a little while becoming as productive in what ever editor you are currently using... Other editors have come and gone. It is still my personal choice and I am still learning new tricks to become more productive in it. I am very impressed it is still so popular to this day. sudo you're welcome.

Collapse
 
matthutchison profile image
Matt Hutchison

It's useful to have a more full-featured editor when having to work from the command line. If you don't work from the command line often (I do), or you're already comfortable with another tool, then it may not be worth it. If you do / want to, it's a good tool to have in the box. I never got the hang of emacs, but either one should serve someone in that boat well.

Collapse
 
matthutchison profile image
Matt Hutchison

Addendum: I use the vim extension in vscode on a Mac and I love it because I barely have to touch a mouse. It is by no means mandatory in IDE-land though.

Collapse
 
sparxmith profile image
Eric J. Falgout

I'm a Vim fan boy but still have a lot to learn.

Vim is almost mandatory if you need to do alot of SSHing into cloud servers for editing files and such.

It is great if you have the time to learn it in depth.

It is not great if you cannot spare time to breaking your Flow to look up commands.

Collapse
 
eljayadobe profile image
Eljay-Adobe • Edited

I use Vim. I think it is great... for me.

Give it a try. If you like it, great. If it doesn't work for you, that's understandable.

You will want to take a quick look at this Tutorial.

I found this to be a helpful Cheat Sheet. (Hmm, although that one is lower resolution than the image I have. UPDATE: here is a higher resolution version.)

Collapse
 
defman profile image
Sergey Kislyakov

I'm using this cheatsheet for now. I already navigate and edit my code with Vim keybindings and I kinda like it.

Collapse
 
dimitri_acosta profile image
Dimitri Acosta • Edited

I've been using vim for almost a year now and even when I am not workin with vim I use a vim plugin form my other editors or IDE.