Hacker News new | ask | show | jobs
by lambda_lord 550 days ago
Helix uses a selection-first action model: you select the word/paragraph/whatever you want to perform an action on, then you change/delete/whatever on that selection.

I think this is more intuitive than the "verb object" model Vim uses: if you get your selection wrong in Vim, you then need to undo the action and try again. In Helix, I can see what I am about to manipulate before I make the action.

I think at this point Vim wins out for being so ubiquitous, but I wish the Helix model took off first.

9 comments

I've set up myself once to learn Helix. First there was Kakoune that sounded exciting with its new modal model, but what had me wanting to really give Helix a go, beyond being exciting, was that it advertised itself "batteries included". It promised to deliver all the cool things programmers' editors do recently.

But then I stopped abruptly when realized Helix misses a key feature of Vim: swap files. I can just start editing and have not have to worry about losing my work, may whichever of computer panic, computer running off charge, environment (desktop env or tmux) crash, etc. occur.

So edit semantics is cool, but fundamentals like recovery should be got right before being a serious contender.

(I did a quick search to see if there is any news on this front, but what I found is all about "recovery hooks for panic", which is far more less than what's needed - it's about an emergency saving of the work if something goes awry with the editor. I need to be protected from loss if something goes awry with the environment too...)

Does anyone else use swap files? Personally, I find them annoying. Saving every time I leave insert mode is my preferred alternative: `autocmd! InsertLeave * silent! update`

Perhaps helix has something similar?

Interesting how every use case is different. I personally hate swap files (they pollute directories and cause annoying warnings when opening the same file two times).
I use both in vim - if the selection is tricky use v or V to define the selection first, but most of the time "verb object" makes sense to me since that's how english works (tho could see it being unintuitive for non-SVO languages). "delete the next word" or "change inside the parentheses" roll off the brain and into the keyboard
To achieve something similar in vim one could use visual selection first and then run the verb on it. Helps with spotting mistakes or just tweaking selections in general. It is a tad bit tedious but a small bonus is `gv` which invokes the previous visual selection at a later point. That said selecting first isn't perfect because large selections often move the viewport around especially on small screens and that's really annoying but ahh that's life, always with the compromises.
The lead of NeoVim indicated that it would be possible to make this "grammar" an option for users. He didn't seem like it was something that's high priority, but he definitely was open to PRs to implement it.
I remember thinking roughly the same thing when I was a regular vim user. This was a long time ago now, so I forget the details, but from memory I used to use visual mode quite a lot, meaning I'd get to use the motion commands to select the region of interest first and then choose the operation to perform on it.

The typical vim model is a bit weird, but once I got practised with it it was actually quite surprising how much complicated stuff I could do purely by sight. But while the muscle memory aspect got me further than I'd have expected, it did only get me so far. Selecting the region first always seemed like it'd be the better way in general, being no worse when your fingers can do it automatically, while being better in the case where you're having to think about what you're doing.

Helix splits the "select" and "verb" portions into two separate actions, so you can't easily repeat the last whole action (which you can do in Vim by pressing the dot key).

Which one is more intuitive is probably subjective, but personally, I find "dip -> delete inside parenthesis" far more intuitive (and closer to my line of thinking) than "select inside parenthesis. delete selection".

The visual-first paradigm means you need to repeat selection, not action, then act on multiple visible selections
This strikes me as the difference between English and Esperanto.

You wouldn’t design English as the international language but that’s what it has evolved to be.

You can still learn Esperanto as a hobby but it’s not going to be as useful day to day as English.

That's what I really enjoy about helix (and kak) - a different approach to the modal editing paradigm.

I'm still stuck on neovim for now, but progressively I'll make my way to helix I think.

Huh, you can do visual selections in vim as well, and manipulate what you selected.
No, you can't, vim visual mode always extends the selection, so moving by two words would select two, not the last one, but to see how it's different the best way is to just use the visual-first editor a little bit
yes it works the same but for example in vim you do 'delete-inner-word' rather than `inner-word-delete`. The selection first model allows you to see what you are going to affect before you perform some verb on it.
I once wanted to try that, but I'm familiar with vim enough that these kind of manipulation is done without even thinking about it. Only visual line mode proves useful when I need to yank/delete whole sections.