Readit News logoReadit News
Posted by u/harco 3 years ago
Ask HN: Is Vim still worth learning?
Dear HN community,

since there are quite some comments highlighting the effectiveness of a good VIM setup and muscle memory of 10+ years, I would like to know your opinion on starting to get into it now (end of 2022).

For context: I'm a backend developer with 10+ years of experience, mostly using Java IDEs, and lately some vscode (for go, typescript, rust). I have some knowledge in vim, and can use it for basic text editing, but I still use the arrows for navigation, and found the "hjkl" navigation difficult. I'm somewhat experienced using linux and the terminal, and would be curious to dig deeper into more terminal-based workflows.

The question is: do you think it's worth the effort to learn using VIM more deeply today? The goal would be to at least be able to do the go and rust coding in vim, it doesn't need to be a full Java IDE. Bonus points for an opinion about "If yes, do you think VIM is still fine, or rather neovim? Or something fresh like helix?"

Thanks a lot!

peterbraden · 3 years ago
Yes definitely. Vim will be around for the rest of your career, long after VSCode or other IDE's have come and gone. Investing in tools and workflows that are properly open source, and have serious longevity has a big payoff.
thiht · 3 years ago
That holds on paper but I'm not sure I agree.

I've used Notepad++, Sublime Text, Atom, and Visual Studio Code. Each of these has introduced game changing improvements (ST has popularized the command palette, Atom allowed high quality, well integrated, and easy to write extensions, VSCode improved upon Atom with way better performance, brought LSP, and drastically improved the remote dev experience). They have in common that switching from one to the other is extremely easy. When VSCode dies, it's because something better has emerged, I'll just have to install the VSCode keybindings on this new editor and I'll be good to go. Because this new editor will adopt the common conventions that everyone use, unlike Vim.

I've used Vim for a year, became pretty efficient with it, but it always feels like it's playing catch-up with other editors. And the modal editing feels more like a gimmick than something really improving productivity. I sometimes open Vim to do some data cleanup, because Vim moves make it easier than writing a script. But when writing code I never think "damn, typing 3dd would be so much faster than selecting 3 lines and hitting delete"

uticus · 3 years ago
Agree with improvements available in other editors.

But disagree with this:

> I never think "damn, typing 3dd would be so much faster than selecting 3 lines and hitting delete"

I actually do think that all the time, and get annoyed when I have to take the second or so to move away from the keyboard to find the mouse/trackpad.

Need to delete three lines, starting with line 54 at the top of your screen? 54gg 3dd

I would never reach for my mouse for that unless I had to.

chezelenkoooo · 3 years ago
Yeah I disagree with the shade on vim motions. I'm trying to use them everywhere and even went looking for a vim and slack integration.

In fact I believe the motions are way more universal than any particular editor's key bindings. There's plugins and extensions for vim motions in almost all editor's I've used barring some database specific UIs.

rob74 · 3 years ago
Maybe... but OTOH, the IDEs that come after VSCode will still follow the UI guidelines that have been established for GUI tools during the last ~40 years, e.g. having menus where you can find out which functions are available, and then memorize the shortcuts for the functions you use most often, rather than having to learn everything "up front" before being able to become productive. I suspect one reason for the longevity of vim is the time that you have to invest in learning it...
Tenoke · 3 years ago
Yeah, switching from Sublime Text to VSCode had basically 0 adjustment period.

I'm not particularly worried about switching to the next one someday nor do I feel like I'm missing out for taking 15m longer per year for the rare server editing of files compared to if I had spent 100+ hours learning vim.

ratg13 · 3 years ago
OTOOH, GUI tools often tie you to a specific workstation setup.

VIM is already installed everywhere you need it and does not require you to have a workstation with a GUI

peterbraden · 3 years ago
I don't think that's true. There are precious few UI guidelines that persist, and GUI design has been on the forefront of many fads. Looking at the touch-first UI of today, I have very little confidence that a GUI will look anything like it does now in 10 years.

Meanwhile, I can use vim over ssh from an iPad if I need to - my tools have come with me.

johncoltrane · 3 years ago
For context, I have been using Vim as my main driver for 12+ years, now, and I have been heavily involved with the ecosystem (patches, plugins, support, etc.) for most of that time.

Learning enough Vim for it to pay off in terms of productivity and whatnot is quite a journey. If you are committed, it might take a couple months to follow chapters 1-12 and 20-32 of the user manual, which will put you in a better position than most Vim users. If your goal is really to be able to use Vim for Go and Rust projects, then there is no way around that first step, but if you somehow don't go all the way, then what you have learned will surely come handy next time you have to use Vim so there is no loss, here.

> do you think it's worth the effort to learn using VIM more deeply today?

I did that and I really love where I am. Will it click for you? I have no idea.

> If yes, do you think VIM is still fine, or rather neovim? Or something fresh like helix?

- Vim (not VIM) has been in active development since 1991 and it is not showing signs of slowing down. It is more than fine.

- Neovim is merely a fork with different goals. At a low level, the two tend to diverge more and more but when it comes to the core user-facing stuff like Ex commands, modes, operators, motions, etc. there is practically no difference.

- Helix seems promising but it is far less ubiquitous than Vim.

Everything is worth learning, whether you have an immediate use for it or not.

snapdaddy · 3 years ago
As an emacs user, I support this comment. I think the main point is that there is a long-term benefit to learning multi-use text editors. Yes, it is painful at first, but the dividends are repaid over time.

As for VI vs emacs - both are good. I would search YouTube for 'Top 10 VIM plugins' and 'Top 10 emacs packages' and see if either grab your attention and go with that.

johncoltrane · 3 years ago
Epic_Handshake.jpg
ndsipa_pomu · 3 years ago
For system admin work, knowing the basics of vi can be really useful when you're suddenly faced with a non-booting system, but you don't need to know much - how to exit being the classic issue. I use vi/vim for really basic editing tasks and switch to something easier for anything more involved (geany being my current choice).
msla · 3 years ago
I came in to say this: Learn basic vi (not the extended stuff Vim added) and you'll rarely be out a text editor, even on very stripped down systems. (In my experience, only nano is more common, and that comes with a keystroke cheat sheet at the bottom of the screen while you're using it.) Learn Vim if you actually like vi and want a more featureful experience in the same basic paradigm.
ndsipa_pomu · 3 years ago
For my sins, I've worked on an old HP-UX system back in the Before-Times and that once required knowledge of vi to get it booting - no nano on that system.

For more modern systems, you can end up in BusyBox and not have access to nano (I think you can specify that vi gets included in BusyBox).

Darkstryder · 3 years ago
Vim is basically the only editor you can safely assume to be available on any machine you’ll ever interact with. In my opinion, this fact makes it a requirement for virtually any developer to be able to confidently use vim during a production incident to, say, fix a broken config file while being connected to the machine through (multiple hops of) SSH, without any ability to use your editor of choice.

Once this basic-but-crucial skill level is mastered, using vim more proficientely as a daily driver is entirely a matter of taste. Personally I prefer using a fully-fledged IDE for anything that goes beyond a simple script.

throwaway_au_1 · 3 years ago
>Vim is basically the only editor you can safely assume to be available on any machine you’ll ever interact with.

Windows?

Darkstryder · 3 years ago
Vim is available on a lot of Windows machines through WSL. I agree this would not be my go-to editor on Windows though.
kstenerud · 3 years ago
TBH I don't think it's worth it. I've been using vi in various contexts for 35 years now but it's just too clunky compared to modern IDEs.

Nowadays I just use a GUI, and only use vi for editing config files and the odd program on a remote system. But even that's being supplanted by editors with remote capabilities.

It's absolutely worth it to learn enough basics to edit files. Beyond that, only if you really dig the editor.

jwarden · 3 years ago
I get a ton of value just from having vim key bindings on the commandline and in REPLs (anything with readline support). Being able to press the up arrow and then quickly edit a typo at the beginning of my previous command without using the mouse saves me a lot of time.
tmarice · 3 years ago
We need an interface to translate our thoughts into the computer, and the keyboard and the mouse are a necessary evil for now. But if you chose a career of software development, you should strive to minimize the friction that interface introduces.

In my opinion, Vim/Emacs are the best way to make that interface as easy to operate as possible, since it completely removes the mouse from the equation. Along those same lines, I felt so much liberated after switching to i3, insomuch that I try to replicate the experience on MacOS, after switching over for work.

EDIT: Also, the obligatory "You don't grok vi" SO answer: https://stackoverflow.com/questions/1218390/what-is-your-mos...

3D25157725 · 3 years ago
No I don't recommend -- and I am a daily vim user for years. I program mostly in C, sometimes C++. I use i3 on my desktop and tmux when remote/ssh'd into a vm. Inside vim, I use the bare minimum of plugins to reduce dependencies/complexity. I use ctags for getting around, as well as the built in features. gdb in a terminal window next to my vim window source. It's fine and snappy and does everything I need.

I live in a terminal except for the browser. Of course my xterm bindings are always vi-mode and tmux too. I have key bindings to unite all my i3/tmux/vim 'getting-around' keys and also fought that fight to unite the clipboards, even across VMs etc.

Getting back to why I say 'no' is because once you're used to the modal, and getting around with the usual vim motion keys, it makes using anything else near impossible and clumsy. I have great difficulty composing text in browser (like right now) and also emails, etc. And if any editor online allows vim keybindings, you must make sure that you are used to defaults otherwise the vim-mode won't do you much good. Like escaping with CTRL-[, or delete word with CTRL-W, which closes the tab in the browser (firefox and chrome and I never found a way to turn that off, so I lose a lot of work that way). For instance godbolt and leetcode both had vi-modes but there's enough of a difference, even though I try to use nearly all defaults, that I still end up composing any code/english in another terminal window.

I am completely hopeless using a mouse or arrow keys. If I have to go to on-site interview and have to use something other than vim, well it makes me look like I haven't sat down at a computer in 15 years. I am a hostage now to my habits and am very wary of hopping over to VSCode/CLion/jetbrains whatever else because I will be a fish out of water.

ormaaj · 3 years ago
Oh please it isn't that hard. Mildly annoying maybe but you can't possibly be that "handicapped" by it. If you're using all that crap and "fought the clipboard unification battle" then you're a bigger geek than 95% of programmers and never had to ask the question "should I learn vim?"

I don't feel the need to use vim exclusively. I like IDEs too, but will probably continue using vim in some capacity so long as it's useful.

growt · 3 years ago
If you just want to learn the basics, you'll be faster with a "modern" editor with mouse and some basic keyboard shortcuts. But if you really master Vim, I would say it's faster and more powerful than any modern editor (and you can use it as an extension in VSCode). For me it's mostly navigating ( 213gg - takes you to line 213, $ - end of line, t) - next closing parenthesis,% jumps to opening closing parenthesis or similar when you're on it, and so on). Macro recording: qe - records macro in "e" ... do vim stuff ... q ... 10@e - execute your macro 10 times. Text substitution with regular expressions (:%s/th(i|u)s/that/g). I think it's not about "hjkl" navigation, that is a probably the tiniest improvement in speed (not lifting your fingers from the home row). But if you master the navigation part and learn how to solve more complex editing tasks with macros and regular expressions, then you'll be a lot faster than in a regular editor.