News for hackers. Stuff that matters.
Re:I have reached Vim nirvana by greyman on Tuesday December 27, 2022 @04:46AM (#34147140)
I don't know why, but vim never worked for me. I tried several times to learn it, but I always forgot the shortcuts... maybe the reason is that I used it only a few times per week, to change crontab or some config file on server.
Re:I have reached Vim nirvana by glotchimo on Tuesday December 27, 2022 @04:48AM (#34147154)
Vim didn’t click for the longest time until I deleted VSCode and used it for everything. Much like with many other concepts/skills, throwing myself in the deep end worked best.
Re:I have reached Vim nirvana by flohofwoe on Tuesday December 27, 2022 @05:07AM (#34147273)
You could just have installed one of the vim extensions for VSCode ;)

(even though it's not 'real vim', it's good enough for using both cmdline vim and vscode without the brain having to switch in and out of 'vim mode')

Re:I have reached Vim nirvana by dpz on Tuesday December 27, 2022 @05:12AM (#34147313)
why swap out of vim mode, add the key bindings to everything
Re:I have reached Vim nirvana by P5fRxh5kUvp2th on Tuesday December 27, 2022 @05:46AM (#34147499)
No vim emulator is "good enough" if you actually know vim, although jetbrains is probably the closest due to the configurability of it's plugin.

there are almost always quirks, but the biggest issue tends to be when bridging the gap between vim and the GUI itself, particularly around the modality of vim vs graphical autocomplete.

If you're less experienced as a vim user these emulators are probably perfectly fine, but as someone who has been using vim for something like 20+ years, they _always_ feel just off enough that I either just go back to vim or edit the way the editor originally intended.

Re:I have reached Vim nirvana by doix on Tuesday December 27, 2022 @05:48AM (#34147516)
The problem with every fake vim plugin is that the underlying editor does not implement tabs the way vim does.

Combine that with the fact that all the UI elements are not vim-ified. In vim, since everything is a pane and a buffer, you just think "I want to select the panel to the left". Regardless of if it's a plugin view or a file or whatever.

In vim emulator's, that's never the case. It's really not the same, but better than nothing. The vscode plugin and the IntelliJ one are both pretty good compared to previous ones that I tried. But the IDEs are just incompatible with the vim ideology, in my opinion.

Re:I have reached Vim nirvana by jrumbut on Tuesday December 27, 2022 @06:43AM (#34147831)
I also seem to run into performance problems using IDEs (even on recent, high end hardware) while vim remains fast.

If nothing else, the performance characteristics of vim are predictable (to me, after all these years) and there are various ways to work around any problems that occur (disabling plug-ins, etc).

Re:I have reached Vim nirvana by ketzo on Tuesday December 27, 2022 @06:56AM (#34147897)
As someone who always wanted to try Vim out, I thought the Vim keybindings plug-in was a total game changer. I only use it for moving around in and manipulating the text - because that’s all it can do - and it’s awesome. Genuine life change.

Just a little counterpoint basically - I don’t think you need Vim’s entire editor model to get a lot of value out of it!

Re:I have reached Vim nirvana by doix on Tuesday December 27, 2022 @07:19AM (#34148019)
I'm sure it is! But I got used to everything following vim logic, so when I use an IDE that doesn't, I miss it/get annoyed.

My comment wasn't meant to dissuade anyone from trying the vim plugins. I was just trying to explain why someone would consider the vim emulation plugins not as good as the real thing.

Re:I have reached Vim nirvana by yakshaving_jgt on Tuesday December 27, 2022 @03:20PM (#34153260)
I'm not sure that's the problem. I think it's more likely one of several, but I'm not sure tabs are all that useful a feature in vim — vim is all about buffers.

Not once in the past eight years have I had to use tabs for something. The buffer list, yes. The argument list, yes. Tabs, no.

Re:I have reached Vim nirvana by doix on Tuesday December 27, 2022 @10:40PM (#34157274)
This guy here [0] articulates my thoughts about tabs perfectly.

If all you care about is buffers, what do you miss about them in vscode or IntelliJ? Their idea of buffers is the same as vim, as far as I can tell.

Or is the problem that the IDE functionality is not implemented as buffers? So you can't use your normal keys in non-text places? That was what I was referring in the second part of the comment.

[0] https://github.com/helix-editor/helix/issues/2295#issuecomme...

Re:I have reached Vim nirvana by yakshaving_jgt on Wednesday December 28, 2022 @03:53AM (#34158971)
If that guy articulates your thoughts perfectly, then I think neither he nor you know how to use the argument list (or, buffers for that matter) in vim.

The workflow he is describing works with :bufdo, :argdo, :bn, :n, etc.

He is also not describing what is special about tabs. Tabs in vim are groups of windows.

I’m not sure if you were asking me, but no, buffers are not the reason why I exclusively use vim.

Re:I have reached Vim nirvana by doix on Wednesday December 28, 2022 @06:49AM (#34160071)
> If that guy articulates your thoughts perfectly, then I think neither he nor you know how to use the argument list (or, buffers for that matter) in vim.

> The workflow he is describing works with :bufdo, :argdo, :bn, :n, etc.

It's different because you are losing context. It's not about finding the right buffer, I understand buffers, I have no problem switching between them and finding them. It's about organizing windows in a way that makes sense and then quickly switching between them.

> He is also not describing what is special about tabs. Tabs in vim are groups of windows.

Exactly! And no other editor implements it that way. It's about context switching quickly. I setup my tabs per context and then I can quickly switch back and forth between them, and have all my windows like I left them.

No other editor does it like that (maybe emacs?), because it does not have the concept of vim tabs. Other editors use "tab" to mean "vim window". I'm constantly wasting time recreating window layouts in other editors depending on what I'm working on.

> I’m not sure if you were asking me, but no, buffers are not the reason why I exclusively use vim.

I'm asking what is missing from the IntelliJ vim plugin when it comes to buffers. The concept of buffers is not unique, most modern IDEs implement them the same way. It's why I'm surprised that you mention that buffers are the killer feature of vim, since I don't see anything unique about them compared to other editors.

Re:I have reached Vim nirvana by yakshaving_jgt on Wednesday December 28, 2022 @07:04AM (#34160175)
> It's why I'm surprised that you mention that buffers are the killer feature of vim, since I don't see anything unique about them compared to other editors.

I'm sorry, I think we have our wires crossed :)

I didn't say that buffers are the killer feature of vim — quite the opposite.

I was replying to the opening sentence of your comment, in which you said:

> The problem with every fake vim plugin is that the underlying editor does not implement tabs the way vim does.

My argument is that problems with vim-like plugins in IDEs like VSC run deeper than just the one you pointed out, especially given — in my opinion — neither tabs nor buffers nor windows are the killer feature of vim. But I can see how my comment can be misinterpreted given I said "vim is all about buffers", which in hindsight I think I worded poorly.

Re:I have reached Vim nirvana by josephd79 on Tuesday December 27, 2022 @08:19AM (#34148335)
this.
Re:I have reached Vim nirvana by tinco on Tuesday December 27, 2022 @05:04AM (#34147253)
Yeah that's got it reversed. Vim is overkill for editing configuration files. You see people use vim for configuration files because it's there and they already know how to use it.

If you really want to ease into it then simply enable the (neo) vim plugin in vscode, it's pretty good. You'll miss some big features but you'll have all the bread and butter features. Only risk is that you'll get used to some vscode features as well.

Re:I have reached Vim nirvana by lawn on Tuesday December 27, 2022 @05:46AM (#34147503)
Only a few times a week is indeed to little to get used to it.

If you're serious about it, you should use it for everything and use it a lot.

Re:I have reached Vim nirvana by yodsanklai on Tuesday December 27, 2022 @05:51AM (#34147525)
I've been using vim forever. I'm fluent in editing files. But what never clicked for me is working with several buffers, making lookups across files, using ctags/lsp and so on.

The right setting for me is Vim within an IDE (nowadays VSCode) but I've found it too complicated to try to turn it into an IDE. I find it appealing to be able to do all your work within tmux/vim, and I know a lot of great coders work that way but it's been too much hassle for me.

I also wonder if Vim is a productivity gain at all. I like to be able to navigate/edit a file without taking off my hands from the home row, and also quickly edit a file when I'm in the terminal. But not sure it really makes that much of a difference when you know your VSCode/MacOS shortcuts, and I suppose that with proper configuration, you can also edit file remotely with VSCode and restrict the need for edition within a terminal.

Re:I have reached Vim nirvana by lvncelot on Tuesday December 27, 2022 @06:18AM (#34147681)
> I also wonder if Vim is a productivity gain at all.

The big productivity gain for me doesn't come from faster editing due to the shortcuts, per se, but from the golden combo of modal editing and macros. Due to how you treat similar looking text in vim, macros are much more powerful than something like multi-line-cursors, which break down when you want to, for instance, delete the first part of 5 pascalCased variables with different lengths. Luckily, iirc, the vim integration in VSCode supports macros, so people who want to keep working in VSCode because of the excellent ecosystem can still have the best of both worlds.

Re:I have reached Vim nirvana by mkingston on Tuesday December 27, 2022 @08:18PM (#34156318)
How would you achieve your example with macros? My inclination would be to do this with regex replace and I can't think how I'd do it with macros. I guess there's some functionality I'm missing? Jump-to-first-upper-case-character?
Re:I have reached Vim nirvana by andoryuu on Wednesday December 28, 2022 @07:21AM (#34160286)
> delete the first part of 5 pascalCased variables with different lengths

In VSCode there are available bindings for subword navigation (shortcuts starting with cursorWordPart).

Re:I have reached Vim nirvana by worksonmine on Tuesday December 27, 2022 @08:01AM (#34148241)
There are probably people who are very effective in vscode and the likes. But my patience is tested anytime I'm helping someone or pair programming and I have to watch them navigate the code and make their edits.

In my head all I can think of is all the ways it could be done faster in vim, so it's absolutely a productivity gain, even if it's just a plugin for vscode.

Re:I have reached Vim nirvana by Hendrikto on Tuesday December 27, 2022 @08:09AM (#34148282)
”Some people are inefficient with X“ does not mean X is inefficient. They may just be bad at using X.
Re:I have reached Vim nirvana by worksonmine on Tuesday December 27, 2022 @08:31AM (#34148413)
While I get what you're trying to say there are benefits to modal editing that learning all the keybindings in X can't replicate. It's difficult to explain and has to be experienced to fully understand.

As a quick example what are the vscode equivalents of I and A to enter insert mode in the beginning or end of a line? These small things quickly add up.

Re:I have reached Vim nirvana by modernerd on Tuesday December 27, 2022 @12:05PM (#34150686)
These days if someone using VS Code asks me how they could be faster, I would be much more inclined to give them some tips that work in VS Code than I would be to encourage them to learn Vim or install a Vim extension.

Ctrl-a and Ctrl-e do what you say in VS Code (same amount of keypresses as “I” and “A”, or fewer if you're in insert mode in Vim, and you never need think what mode you're in).

Ctrl-w gives you visual selection of the word under the cursor. Repeat to extend the selection (similar to nvim-treesitter's init_selection and node_incremental, but you don't have to set up treesitter and bind shortcuts or learn how to use visual mode).

I use Neovim and learned to use VS Code without Vim extensions (to help/teach others, and out of professional curiosity!).

Editor “X” absolutely can replicate features from Vim well enough in a lot of cases for the differences not to matter too much, because editor X also does some things better or faster than Vim. Plus we can fill in many gaps that really bother us with extensions. For example, this extension for VS Code lets you switch the cursor from the start to the end of a selection similar to 'o' in visual mode in Vim: https://marketplace.visualstudio.com/items?itemName=rioj7.se....

What _does_ seem to be true is that people who use editor “X” are sometimes less vulnerable to spending their free time learning the features and shortcuts of their editor that would make them just a little bit faster. Vim/Emacs users tend to do that because for us text manipulation and editor hacking are a weird kind of hobby.

But I pair with a lot of senior devs who are _very_ fast with VS Code/IntelliJ these days without Vim extensions. I have also spent much less time making VS Code completely keyboard-driven than I have customising my Neovim config to achieve largely the same abilities (only with Neovim I also lack a lot of healthy things like screenreader support). In VS Code I just needed:

- File Browser (keyboard-driven file nav/creation without using the tree view): https://marketplace.visualstudio.com/items?itemName=bodil.fi...

- Edamagit (keyboard-driven git commits): https://marketplace.visualstudio.com/items?itemName=kahole.m...

- [Optionally]: VSCodeVim ( https://marketplace.visualstudio.com/items?itemName=vscodevi... ) or VSCode Neovim ( https://marketplace.visualstudio.com/items?itemName=asvetlia... ).

Re:I have reached Vim nirvana by worksonmine on Tuesday December 27, 2022 @12:33PM (#34151145)
Yeah, I did a search and realized it was the emacs bindings but didn't bother editing my comment as most people I've worked with don't know them or even stop to consider if it's possible. A better example would be o/O, c3w, ci) and so on. Even holding Ctrl+[Arrow keys/backspace/delete] to move word by word is rare to see even if supported everywhere.

Of course (and I mentioned it in my first comment) there are people fluent in vscode but it's far from the norm, and doesn't have to be. As you say for vim users it's a hobby or even lifestyle.

But this thread started with questioning if "vim is a productivity gain at all", and I'm confident it is. I use it everywhere from window manager to browsers, and where it isn't natively supported by plugins/extensions I add my own keybindings to get at least movements and scroll.

Re:I have reached Vim nirvana by yakshaving_jgt on Tuesday December 27, 2022 @03:17PM (#34153221)
Funny, several people commenting on this post are making exactly this argument, but at vim's expense.
Re:I have reached Vim nirvana by gfaregan on Tuesday December 27, 2022 @10:16AM (#34149364)
I'm not sure if it's much of a productivity gain, but the way I have it set up it is really easy to navigate quickly and precisely through buffers, folds, characters, etc. And it always works once I've installed my config files without any further messing around.
Re:I have reached Vim nirvana by LinXitoW on Tuesday December 27, 2022 @10:18AM (#34149374)
To possibly answer your question, think about conveniences that every editor gives you: Editing per (UFT8) character, instead of code points, or bytes or even bits. Would that make you less efficient? I'm sure it would.

Conversely, saying "delete in parens" instead of "move forward 5, delete back 10" is also a real gain.

That being said, use what you have. With editing, and navigating the same file, Vim or it's emulations are almost always better, but most editors offer great cross-file features you should also use, like the "shift shift" in Intellij IDEs, or "ctrl-p" in vscode.

Re:I have reached Vim nirvana by lvncelot on Tuesday December 27, 2022 @06:13AM (#34147654)
It was the same for me, for a long time. I've just used vim for commit messages since I was to lazy to change $EDITOR. Then, I can't even remember why exactly, I've taken a few weeks to actually learn the basics. The first few months were a little awkward, since I wasn't as efficient as I was in Sublime Text (which I've used at the time), but I also started to miss some vim keybindings in other editors. After a while, everything clicked and now I have vim keybindings in almost every program where it's even remotely possible. (Shoutout to tridactyl[1]). I think the most important part is to slog through a couple of longer coding sessions, like you said. (Although vimtutor is a good start, as well, and a colleague of mine got started using vim adventures[2])

[1] https://github.com/tridactyl/tridactyl

[2] https://vim-adventures.com/

Re:I have reached Vim nirvana by _448 on Tuesday December 27, 2022 @07:10AM (#34147962)
> I tried several times to learn it, but I always forgot the shortcuts...

If you keep at it you will develop the muscle memory. I am not an expert in Vim, but I use it whenever I want to write some code. Once I was given a coding problem to solve. The interviewer gave his laptop to me with part of the program implement and I had to complete the program. The problem was the C++ code was written in Visual Studio on Windows and I had not used that setup for a long time. So it was frustrating for me and amusing to the interviewer to see when I use to press Vim keystrokes while writing the code in VS :)

Re:I have reached Vim nirvana by tomkarho on Tuesday December 27, 2022 @07:35AM (#34148099)
> So it was frustrating for me and amusing to the interviewer to see when I use to press Vim keystrokes while writing the code in VS

And this is why I have never been comfortable with vim or the idea learning it on that level. Why would I spend time muscle memorizing a program that conflicts so much against all other editing software and related paradigms? The skills do not scale enough to make it worth the effort imo. Sure your vim powers skyrocket but any other interface where you have to type becomes a nightmare to work with effectively.

Are the advantages of working really really well with one tool worth the effort when you lose productivity in every other tool (99.9% of them) out there? Maybe if you can live constantly in vim but how many of us truly only edit text files during our day to day?

Re:I have reached Vim nirvana by atarv on Tuesday December 27, 2022 @08:34AM (#34148438)
Learning vim has actually made it easier for me to use other IDEs and editors. Most of them have plugins that provide vim keybindigs for editing.

Many other programs loosely follow vim bindings. For example if you enable hotkeys in GMail webclient you can use j and k keys to move between emails, press / to search just like in vim.

In the comment you replied to the author was in an interview situation so they didn't have time to install any plugins.

Re:I have reached Vim nirvana by eimrine on Tuesday December 27, 2022 @10:33AM (#34149499)
> Why would I spend time muscle memorizing a program that conflicts so much against all other editing software and related paradigms?

Because no other editor is oriented to muscle-memorizing.

> any other interface where you have to type becomes a nightmare to work with effectively.

Something tells me that you are talking about some interfaces with mouse. It's really a nightmare for mine inner vimmer to get my hands out of keyboard in any other editing interface or even to look at keyboard for searching those Alt-Ctrl-Shift chords.

Re:I have reached Vim nirvana by andrepd on Tuesday December 27, 2022 @07:50AM (#34148176)
I was deep into the vim rabbit-hole for about a year and a half. Read all the guides, got all the plugins, kitted out my vimrc, all that stuff.

Then one day I realised I was still more productive in sublime with its simple but powerful keybindings than I was in vim. I dropped it and never looked back.