Ask HN: Is (n)vim worth the trouble?
My main editor for the past few years has been vscode, but I've dabbled in emacs (Doom), neovimm and helix. I keep coming back to vscode due to the plugin ecosystem and ease of setup. But sometimes I watch long-term vim users writing code and I'm amazed at their efficiency.
But maintaining an up-to-date (n)vim setup seems like a huge time sink. In my experience, plugins are constantly deprecated and forked, or have breaking changes that need to be debugged. Part of this is just the open source dilemma.
For those of you who use vim as their primary editor, or have switched to/from vscode, do you believe all the extra effort required for vim is worth it?
54 comments
[ 2.9 ms ] story [ 121 ms ] thread> maintaining an up-to-date (n)vim setup seems like a huge time sink.
I find that updating plugins does often break things, which is why I don't update plugins (that are in a working state).
I switch mostly between nvim and jetbrains products. nvim is my simple editor for adhoc stuff that I don't want to open an ide for.
I've tried switching to nvim too but I really like my vim setup so it never feels quite right.
If you can code in vscode and you like the interface than its probably not worth it.
https://survey.stackoverflow.co/2023/#section-most-popular-t...
https://news.ycombinator.com/item?id=30848456#:~:text=%3E%20...
And a good chunk of the 22.29%(vim)+11.88%(neovim) on that survey likely do not configure it out of the box (defaults) and are not using it as their sole/primary editor.
Outside of the stackoverflow sphere, (n)vim usage is far less (globally).
Aside from general usage scenarios, plugins and configuration is finicky and difficult most of the time. It requires care, maintenance and debugging to get things to work - and having to configure LSP/Tree sitter and other things can be frustrating. Things have gotten better, but OOBE leaves much to be desired.
The quality of plugins seem to be somewhat better on VSC (though for some of the more established plugins, (n)vim have really good ones - so it's about even here). It is a simple matter of searching for what you want in the Marketplace.
VSC gets me up and running in 15 minutes on a new machine, if necessary and provides enough working defaults that I can reasonably expect other people to be using the same thing. If not, it is a simple matter of creating a new profile (File>Preferences>Profiles>New) on someone else's machine - making my tweaks and I'm off to the races. I don't have to dive into someone else's config.
As far as being judged harshly, I am not surprised at the responses I have gotten - the fact of the matter is: you have to be a unique person to want to use (n)vim. Just by virtue of using (n)vim, emacs or similar style editors - you are already in the outlier of users that code/program on their computer. Just like being here on HN already puts you on the outlier. HN, Reddit, stackoverflow all exist in their own bubble of technically skewed, predominantly male in their 20s to 40s.
And then when I open up (n)vim in a shell, the muscle memory carries over.
I'm curious what people's thoughts are with a slightly reframed question: is explicit practice with your editor worth it?
While it would be nice to edit more efficiently, it's usually not a bottleneck to how fast I can create software.
If you can always use an IDE then do that and don't worry about vim or emacs. There's no actual club of greybeard CLI hackers who will not let you join if you can't h-j-k-l everything.
If you need to work directly on a server over ssh, especially a server you don't control, you will probably have to use a terminal-based editor. If vi/vim is too much use nano.
Our brains can learn multiple editors, multiple programming languages, multiple frameworks, etc. I never understand the questions that pose a false dichotomy: should I learn vim or VSCode? Python or Clojure? You can of course learn them all. And if you use something every day you will get better with it. If you take the time to practice you will get even better. Whether that investment of time and effort pays off eventually, hard to say, but knowing vi/vim well enough to edit code has paid off for me and a lot of other people, so I'd call it low risk/potential high reward. I also learned VSCode well enough to use it, so hedging my bets.
That Free your mind from mental disruption of using mouse and clicking things and then put you in the zone for writing code, and then you can write code at speed of though, combined with a tiling window manager.
The editor itself doesn't really matter.
Learning mode based editing with vim key bindings absolutely is.
You get like 90% of the benefit that brings with any editor that has good support for vim style interaction.
I still regularly use nvim in my terminal for quick edits here and there, but do my development in VSCode and spend a lot less time managing a config/plugins/etc.
My one suggestion is to change your escape binding to something like 'kj' or an easily accessible two letter sequence that doesn't appear in English text. Your fingers will thank you for it (even if it makes using default setups on systems you don't control a bit disconcerting for 30 seconds).
I think you can however `inoremap <C-c> <esc>` locally to make it a bit safer, and just use the default Ctrl-C remotely (if your vimrc is not there then there’s probably no plugins or abbreviations to worry about).
just use caps lock for esc. even the mac supports it.
Whether it’s “worth the trouble” for you really depends on you, what you value and what you do so it’s hard/impossible for anyone else to judge that for you. But if you’d asked 2000 me why I used vim I would have said because it’s great to be able to use the same editor for fixing config files over laggy remote ssh connections, or writing perl as for writing my email. If you’d asked 2005 me I would have said it’s great to be able to use the same editor for bash and python scripts as I use for massive Java and c++ codebases. If you’d asked 2011-ish me I would have said it’s cool that the editor I already know well supports these new languages I want to learn like haskell and scala, etc… Fast forward to yesterday and I spent 5 hours writing latex in vim and of course it works great.
So I guess what I’m driving at is this. You have no idea where life will take you and what you will end up doing but having this transferrable set of skills so you know whatever you’re trying to do with a computer you have a toolbox that you can apply to get a leg up on any new problem is very valuable.
The one real advantage of something like vim that is very hard for any normal IDE to replicate is that it could be part of that toolbox no matter what. You have to decide whether that’s valuable for you.
And you really don’t have to maintain any kind of up-to-date setup. I occasionally tinker because I like tinkering but the vast bulk of my vimrc I wrote in like 2002 or so and has remained unchanged. Every now and again I add a single line to add or remove a plugin, but it’s really not the be-all/end-all to make changes.
It's 2023. Our keyboards are standardized (looking at you, Chromebooks) with control, alt, altgr, meta keys.
I can't understand why micro is the only console/cli editor that (partially) supports 1987's CUA standard[1]. All I want is TUI text editor or IDE that let me use Shift-Arrows to select text, Home/End keys should do what their names say, but if you hold Ctrl, they go to the beginning and end of file. I'd like to use use Ctrl-Ins/Ctrl-Del/Shift-Ins/ to access the Clipboard. Can we also have some menu or palette system, perhaps context-sensitive that includes every mapped shortcut? How about an easy system to create some windows or panes that can. E easily moved and resized? Wouldn't it be terrific if I pressed momentarily say, control-alt, and a calculator, calendar or a terminal showed up?
MS-DOS edit.com, Borland SideKick and Turbo IDEs had all these em 1991. I'm very fond of Midnight Commander editor, micro, joe, nano exactly because they have this DOS atmosphere, where the learning curve looked more gentle.
Linux and other unices got into a very interesting scenario. If the application is intended to run over a graphical desktop environment, it'll likely follow the CUA specs. OTOH, console/cli tools decided they don't care about CUA or current UI/UX practices (notable exception is micro), they will keep using standards created 40+ years ago, ignoring the standardization we've adopted since PC GUI massification around 1990.
[1] https://en.wikipedia.org/wiki/IBM_Common_User_Access
In terms of efficiency/productivity/time saved, my guess is that it's not worth it.
In terms of happiness, I love it. I live in vim+tmux+bash. My setup is extremely personalized. If anything annoys me about my day-to-day activities, I can just change it. It can be a time sink, but I enjoy it.
For me, I wouldn’t be using vim if there wasn’t a productivity bump. When I became comfortable with vim I was appreciably faster, but it took maybe a year to get to that point. Not having to reach for the mouse is a huge benefit. Macros turn repetitive manipulations to a from O(n) to O(1). Using the dot key to repeat a change can be very powerful too
In terms of happiness, I agree. Productivity is not bad too (understatement of the year :). But as for any powerful tool, to get the most or even a lot from it, you have to spend some time. But IMO at least, the learning curve is shallow, for easy to medium tasks.
And anyone not knowing the basics of vi, can get started very quickly with my vi quickstart tutorial below.
I had first written it at the request of two Windows sysadmin friends of mine, in a company where we were working at the time.
They had been given additional charge of two Unix boxes, so, being busy people, as sysadmins usually are, they asked me to write a tutorial that would let them hit the ground running for common sysadmin text editing tasks. After reading it and using Unix for a few days, they told me that it was useful and met their need.
The tutorial is small, so it can be read soon and you can start applying it right away:
https://vasudevram.gumroad.com/l/vi_quick
It enables you to start with just some basic vi commands, and as you go, you can build more vim-fu by reading the docs, blogs, videos, practicing, etc.
Also be sure to check out this famous StackOverflow answer to grok the zen of vi:
"Your problem with Vim is that you don't grok vi.":
https://stackoverflow.com/questions/1218390/what-is-your-mos...
If you're working a lot with text, Vim macros are great. I'll regularly go into Vim as kind of a text workbench.
If you want to try an auto-updating Vim suite, check out LazyVim [0]. The defaults are great, and there's a lot of features with absolutely zero configuration.
[0] https://www.lazyvim.org/
Neovim was introduced about the same time than vscode but I prefer vscode with a vim plugin. Before vscode and neovim I had many weird setups. The weirdest I used for a while was perhaps eclim, that is vim and eclipse together, but vim as the user interface. http://eclim.org/
I think it depends on your platform? On macOS, nearly all apps support a (very small) subset of Emacs keybindings. On all platforms, Readline and friends default to Emacs keybindings (but do support Vi).
On the other hand, many classic UNIX utilities - for instance `less` - also implement Vi-like keybindings for navigation and search. There’s lots of third-party TUI applications that copied some keybindings from Vim. Many GUI applications (e.g. Sublime, VSCode, Firefox, Chrome, Google Docs, Obsidian, …) have support for Vim keybindings either as a popular plugin or bundled.
My guess would be that more apps support Vim keybindings than Emacs keybindings, simply because Emacs users would prefer to implement their needs (email, notes, …) inside Emacs instead of going to a third-party app. But I don’t have statistics to back that up, just subjective observations :)
Secondly people, especially with neovim, seem to be hellbent on turning the thing into a GUI editor anyway, with bespoke search interfaces, file tree plugins, graphical plugin installers, and so on. At which point I don't understand why you're not using something made for that purpose rather than painfully try to reinvent it in a piece of software designed to output text
1. Do you work on really large codebases every day?
2. Do you type as fast as you can think and frequently need to wait for the UI to catch up with what you just typed?
3. Do you have a large codebase sitting on a remote computer?
4. Do you have to ssh into random computers or embedded devices and quickly edit or modify something inside?
For me, the answer to all 4 questions is yes, I’ve been using neovim and vim before that for most of my career. I can strongly recommend it.
You either have too many plugins, or are in a part of the ecosystem where vscode is probably a safer bet right now (still maturing). My vimrc, including the few plugins I use, has barely changed in years (seriously, last commit 2021, last before that 2020).
Edit: Actually I have 10 plugins, so not as few as I thought. Stable ones, though.
I think it's worth putting the effort in to learning core vim functionality. Once you do then you find that you don't need some of those plugins that you're having trouble with.
These days I run with a pretty light .vimrc and no plugins.
If I were you I would start by enabling vim mode in vscode and practicing there. You get autocomplete by default and a familiar environment and can just focus on gaining keybinding proficiency. Then, as you get more experienced the new shortcuts you will want to define will come naturally.
There are definitely moments that result in a bit of time sinking. Overall the tradeoffs work out for me.
Most modern IDEs have a straightforward enough vim plugin that just works in my experience (at least the JetBrains ones do).