Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Helix is really great. If only it had a VIM (or VIM-like) mode available. I find the Kanoune shortcuts really limiting, as they fail to use the relative line numbers for anything except moving the cursor. Bidirectional selection, deletion, commenting, etc. is super useful when coding.


Could you give an example of an edit you couldn’t express?


Say I am at the last line of a part of a function, that I would like to delete - maybe some debug output. In VIM, I will look at the relative line numbers and immediately see that I would like to delete up to the number 8. Then I simply write d8<up> or d8h, and I am done.

As far as I can tell - I may be wrong - in Helix, I would have to first do 8<up> and then 9xd. Note the number 9 in there. This is due to the fact that in Helix, I have to count the number of lines I want to delete, rather than just being able to look at the relative line numbers.


In Helix you'd have to x downward or use v to enter visual mode. But you initially said that you "found kakoune bindings limiting". In kakoune you can 8Kxd, or 8K<a-x>d on less recent versions. The vim approach is usually superior for simple commands like "delete N lines", the kakoune approach is superior when you want to compose commands, e.g. `%sif<ret>f(<a-i>(sand<ret>cor` is "select all `if`, find `(`, select inside `(`, select all `and`, change to `or`"


Legit. You can do nicer than that in Helix’s defaults, but you're right that it won't match d-8-up’s concision: instead of 8-up-9-x-d ("8-move up-9-select whole lines below-delete"), you can do v-9-up-x-d, ("select-9-this line and above-the whole lines-delete").

If you're asking about what helix can do in general, though, as opposed to just the defaults, you can configure it to:

  - use relative line numbering
  - map a key (say, capital X) to the opposite of x’s behavior — or even better, to `[“extend_line_up”, “extend_to_line_bounds”]` ; the latter won't "eat" the first press by using it to select the current line.
  - make the same tweak to lowercase x
Combined, that will get you back to 8-X-d (“8-select whole lines up from here-delete”) to delete up through where you can see 8 in the gutter (and 8-x-d in the other direction).


Thank you for the great answer. I did not know that. I will try it out.


In Helix, you can use `maf` to mark the outer function and then press `d` to delete it.


Agreed, but more often, I find myself in a situation, where I just want to delete, comment, or yank a few lines of a function, so I find that going by relative line numbers is a lot more flexible and useful for me.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: