helix icon indicating copy to clipboard operation
helix copied to clipboard

Counts for commands

Open Zoybean opened this issue 3 years ago • 3 comments

Document which commands accept a count

From the usage and keymap pages of the documentation, it is unclear which commands accept counts and which ignore them. I think it would be good to document exactly which commands do / will accept a count, either as a summary or per-item in the keymap. As an example, when writing this issue I was under the impression that Alt-( and Alt-( did not accept a count, and almost suggested something like the current behaviour as an improvement, leading me to discover the current behaviour.

Allow more commands to accept a count

Some commands do not currently accept a count, but could benefit from allowing repetition. (this list may be incomplete, and I'm keen to promote discussion what could/should be changed):

  • ms - to allow surrounding with multiples of a character, e.g. ms*ms* becomes 2ms*. However I realise this would be inconsistent with how counts work on the other m submode commands.
  • . - to allow repeating arbitrary changes
  • Alt-. - to allow repeating arbitrary relative motions
  • Alt-, - to allow removing series of cursors

Zoybean avatar May 15 '22 04:05 Zoybean

Not sure if any of those would be worth implementing, but here are some commands in vim that take counts, that do not in helix:

  • Counts with i/I/a/A, cause the additions to be repeated when you hit escape.
  • Counts with d and c delete or change the next n characters if there is no selection, but ignore the count if there is a selection. With helix's select-act model it seems less obvious how those should work.

Zoybean avatar May 15 '22 04:05 Zoybean

Possible improvement to counts on transposition: #2478

Zoybean avatar May 15 '22 05:05 Zoybean

count also doesn't work for: gn & gp

txtyash avatar Sep 16 '22 19:09 txtyash