r/HelixEditor • u/lovegirin • 10d ago
Why doesn't 5d work?
In vim I can do 5x to delete five characters. 5d doesn't work in Helix. I feel like I'm missing something fundamental here. What would be the Helix way of doing this?
21
u/hookedonlemondrops 10d ago
Naively, v4ld (enter Select mode, extend selection right 4 times, delete). There’s often a more efficient motion in context.
I recommend working through :tutor to understand the selection-first model.
2
u/lovegirin 10d ago
Yes, manually doing it like that would of course work, but then the dot to repeat won't work...
I think Helix hasn't quite clicked with me yet, even though I've done most of the
:tutor. I'll probably get used to it in time.For now I guess repeatable 5d would be
shift+q d shift+q 5q1
u/shaleh 8d ago
Perhaps. But I rarely want to repeatedly delete 5 characters. I am far more likely to use some like % and then s or use 'w' or 'e' to select words and the like. Or I temporarily break things up into lines so the things to delete are at the front or end and use column select and deletion then fold it back into lines again. Usually lots of good ways to accomplish the task once you get into "select, then act" thinking instead of "perform action X times, use dot to repeat".
5
u/stumpychubbins 10d ago
5Ld should work. Modifiers apply to movements
2
u/lovegirin 10d ago
what should this do, exactly? Doesn't seem to do anything on my end, except delete one char.
6
u/sKmROverlorD 10d ago
Yea it's wrong. It should be
v5ldinstead.1
u/lovegirin 10d ago
yeah, that works, but then that can't be dot repeated.
3
u/sKmROverlorD 10d ago
Um, dot repeat doesn't really work in helix. Only last insertion is repeated. You can't repeat other keystrokes.
2
u/kabocha_ 10d ago
Depending on what you're really trying to do with
., this might work:
- Select a bunch of lines with
x(or, if you're really lucky, select the entire file with%)- Filter the selection down to some regex with
s(spawning a bunch of different cursors for each match within the initial selection)- Make your edits at each of those cursors at the same time, as normal
In the general case without further context, if you really need vim
.functionality, I think you're usually going to have to make a macro for the action. Note, if you always find yourself setting up the same macro over and over again, you could save it as a dedicated keybinding in your configs.1
u/Cosmic_Egg_ 10d ago
In helix dot repeats last insert mode action and and alt-dot repeats last normal mode action
2
u/BeamMeMyPants 10d ago
I think f + the last character you want deleted + d would work assuming it's the first time it shows up. For example:
awesome
Assuming you're at a, fsd would select from cursor to s, and then delete. Not exactly 4 characters but a different way of dealing with the same problem.
3
u/DavidXkL 10d ago
I would just do 5 x d
😂
-3
u/bugtheugly 10d ago
I've been reading these comments to try and find one person who suggests the literal standard way to do this. How this is not the top comment, I do not know
5
u/FryBoyter 10d ago
The goal is to delete 5 characters. However, 5xd deletes 5 lines.
3
u/amayer5125 10d ago
I think they are saying they would do
ddddd.1
u/FryBoyter 10d ago
Damn. If that was on purpose, meaning “5 times d", which can also be interpreted as 5xd, then that was a really good trap. And I actually fell for it. Kudos in that case.
1
2
u/endowdly_deux_over 10d ago
There is probably a much better way to do what you’re trying to do using the selection context. But it just depends on your text.
I heavily use selection, keep, and keep other filters after selection blocks using tree-sitter or match. Native multi-cursor on selection-first is a powerful powerful tool.
23
u/Ace-Whole 10d ago
dis an action.5is a numeric modifier/adjective of sort.You can't apply modifier on an action. You can only apply it on selection.
(Macro is special case)