From VS Code to Neovim, is it worth it?

My journey with text editors and IDEs that I have been using primarily for web development dates back to WebStorm, followed by VS Code, eventually resulting in using Neovim as my primary code editor for about two years. Yet if anyone asks me whether they should switch to Neovim I tend to discourage them, despite never imagining myself to go back to an IDE without near perfect Vim integration.

However since then I have returned to VS Code with Vim plugin as Neovim configuration with all the plugins I was using was just too much work to maintain and some things were always too painful to do in Vim (e.g. debugging, Jupyter notebooks).

What I would always recommend instead of switching to using Vim in your terminal is to give a shot to Vim keybindings extension in the IDE you are using right now. You might lose some productivity initially but it should maybe take you only about two weeks to reach a point where you are more productive.

How do I exit Vim?

It's probably the first thing a programmer learns, yet once you know Vim, you won't even need to exit it.

In a day to day you might end up using sessions with a shortcut to close all buffers simultaneously:

:wqall<cr>

In any case this isn't a tutorial on how to survive your first ssh connection, but I think most of us encounter this problem at the beginning of our career or at school.

Vim Matrix Meme

Vim customization, the perfectionist's nightmare

There is Vim and then there is a massive ecosystem around it. You might need to develop an obsession to actually get through the pain of setting Neovim up.

Start with Neovim defaults and add what you need as you go. At the beginning you might easily get distracted wanting to try every plugin you see, but eventually you will reach a point where you are happy with your configuration despite its imperfections. Find some dotfiles repository on github and start putting parts into your own configuration, as a bonus you might learn Vimscript or Lua along the way.

Your configuration will never be perfect, but you don't need to abandon your former IDE entirely if it does something extremely well out of box (e.g. debugging, working with Jupyter notebooks).

I actually think now that maybe the best way to go is to just use as little plugins as possible, if you can make that work for you, rather than turing Neovim into VS Code with all the plugins.

Why would you choose to learn Vim?

In my case I am fascinated by things that are easy to learn but can take decades to master. Whenever I learn something new with Vim my productivity and joy of coding goes up. I look for these things both in my work and hobbies.

Vim shortcut meme

Vim is interconnected with your typing skill and the keyboard layout you use.

I cannot say it improves your work output that much, because you will still be throttled by your brain capacity, but it does make the whole process much more enjoyable and allows you to stay in flow state much more effortlessly, particularly once you add Tmux to the mix and control nearly everything without a mouse.

Hello Tmux

Tmux allows you to stay in your terminal and easily navigate between tabs and panes using only your keyboard. It becomes extremely powerful when you are working with several projects in parallel and need to copy code from one project to the other.

Plus, you can make it look nice.

Learning curve

The first thing you should take into consideration is to learn touch typing if you don't know it already. That should yield benefits on its own even if you never learn Vim at all.

Touch typing on it's own is a fun addictive activity, particularly if you deliberately train for accuracy and speed.

Vim learning curve

This image is exaggerating, as I mentioned at the beginning of this article to start using Vim in your current IDE as a keybinding extension it might only take you around two weeks to see a noticeable improvement in productivity and I encourage you to not rush into switching to Neovim straight away.

Progression path

My recommended progression path to learn Vim would be as follows:

  1. Learn touch typing
  2. Use Vim keybinding extension in your current IDE
  3. Move away from the IDE terminal to Fish or Zsh shell in terminal like iTerm2 (now if your IDE crashes, your terminal stays alive and vice versa)
  4. Start using Neovim with defaults to accomplish ~80% of tasks you do in your IDE
  5. Add Tmux to the mix
  6. Customize Neovim to be able to use it for ~99% of the tasks you do in your current IDE

Good tutorials for Vim are vimtutor (free in your terminal and doesn't take long) or Vim Adventures (paid but free to try with nice gamification).

Selling my mouse and buying my first mechanical keyboard

Wait, what is a 60% keyboard layout? So you're saying all these membrane keyboards are garbage?

Mechanical Keyboard Meme

Common sense is generally applicable here, everything is a tradeoff. I really do appreciate the portability and low weight of membrane keyboards, but I find their feel not very satisfying or ergonomic. I have found that low-profile mechanical keyboards are the best of both worlds for me.

Think of yourself as a musician and of the keyboard you use as your instrument. You can go a bit wild here and build up your keyboard collection. Given the amount of hours you end up using a keyboard every day, it's not all that unreasonable.

Plus, you will save all that money not having to worry about mouse anymore.

Dude, where are my arrow keys? Programming your first keyboard

If you end up getting a keyboard with a compact key layout you might suddenly notice that you have no arrow keys. Don't panic.

Moving your hand from hjkl was a waste of time anyway; just use Karabiner with some modification rule. The same can be done for merged Esc and ~ key. Save yourself some trouble and use a declarative config file with Goku. See my dotfiles for example.

You can take it one step further and get a hardware-programmable keyboard like ErgoDox EZ, but the advantage of programming your keyboard with software is that it will transfer to your laptop keyboard or any keyboard you will use as well.

If you're ever deciding between 60% or 65% layout, I think the 65% is the compact sweet spot, and less isn't always better.

Conclusion

The choice of developer tools is generally individual (unless your company enforces a particular tool), no matter what you use—I would strive to be efficient. I have learned a lot from trying out Vim, and I think if your career is longer than 10 years, it's worth giving it a shot. You can always go back to what you used before if you don't like it.

The fact is, Vim is not popular, but given its learning curve, it's not that surprising. Think of the entry barrier to learn programming; it's hard to learn Vim on top of that, but if you learn continously over lifetime you should find time for it. If you are just starting out with programming, an IDE should not be your primary concern, but if you are wondering what to learn next, here is an idea.

Once you are a Neovim user, there is also a configuration overhead whenever you need to setup support for a new language or framework. The setup generally will not be as smooth as in VS Code or any other IDE, where things tend to work out of box and save you time.

Additional Resources

Introduction video, books, and resources I recommend to learn about Neovim and discover its ecosystem: