Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some minor mode commands are absent from the Command Palette (and cannot be rebound). #9814

Open
7ombie opened this issue Mar 5, 2024 · 5 comments
Labels
C-enhancement Category: Improvements

Comments

@7ombie
Copy link
Contributor

7ombie commented Mar 5, 2024

While the Command Palette includes stuff like select_textobject_around and select_textobject_inner, there doesn't seem to be any way to rebind the corresponding subcommands.

For example, you can rebind the ma part of maf (match around function) to a use a different prefix, but the f part cannot be rebound. There's nothing like select_textobject_around_function to bind to.

I care because I renamed the Tree-sitter types, so they all have unique initials, and have various bindings based around these initials, so it's confusing to have a minor-mode that uses conflicting mnemonics. This is what I want to use:

  • b: block/paragraph
  • c: comment
  • d: diagnostic
  • e: edit/change
  • f: function
  • p: parameter/argument
  • t: type-definition
  • u: unit test
  • w: word
@7ombie 7ombie added the C-enhancement Category: Improvements label Mar 5, 2024
@kirawi
Copy link
Member

kirawi commented Mar 5, 2024

This is covered by #1383 and it looks like the related PR is marked for one of the next releases

@7ombie
Copy link
Contributor Author

7ombie commented Mar 5, 2024

Thank, @kirawi. You're right, #1383 looks like it will fix the issue, and we can follow up there if not. Happy to close.

@7ombie 7ombie closed this as completed Mar 5, 2024
@7ombie
Copy link
Contributor Author

7ombie commented Mar 7, 2024

@kirawi - Turns out #1383 won't support what I'm asking for here, so I'd like to reopen this issue. It seems inappropriate to discuss this issue at any length in #1383, as that feature still provides all of the advantages it set out to provide. It just doesn't handle this case.

@pascalkuthe
Copy link
Member

What you are talking about here isn't a minor mode but remapping hardcoded pending keys. These should just be seperate commands. The blocker to that is currently that there is no way to have a falltrough mapping (so mix works). This is a known issue and I am pretty sure there is an issue about it but I can't find it.

Minor mode would be <space> which can be re-created manually altough its a bit painful right now. Potentially extending the keymap to have named command groups which can be mapped to keys could be added to adress that (with each of the current minor modes being a names command group)

@7ombie
Copy link
Contributor Author

7ombie commented Mar 7, 2024

What you are talking about here isn't a minor mode but remapping hardcoded pending keys.

Sorry. What I meant by "minor mode commands" was simply the commands are only accessible via minor modes. I see now that the term is a little misleading.

Concretely, this is what I'm trying to do here...

I have a simplified Match Menu that retains the following commands:

  • m Goto the character that pairs with the character under the cursor.
  • r Replace nearest pair of char0 characters with char1 characters.
  • s Add a surrounding pair of char characters to current selections.
  • d Delete the nearest surrounding pair of char characters.

I have removed a and i, as I have other bindings for the corresponding actions. These are for selecting inside the item:

  • Optionb Select inside the current block/paragraph.
  • Optionc Select inside the current comment
  • Optionf Select inside the current function.
  • Optionm Select inside the closest matching character-pair.
  • Optionp Select inside the current parameter/argument.
  • Optiont Select inside the current type-definition.
  • Optionu Select inside the current unit test.
  • Optionw Select inside the current word.
  • OptionW Select inside the current longword.
  • Option× Select inside the closest matching pair of × characters.

And these are for selecting the entire item:

  • Controlb Select around the current block/paragraph.
  • Controlc Select around the current comment
  • Controlf Select around the current function.
  • Controlm Select around the closest matching character-pair.
  • Controlp Select around the current parameter/argument.
  • Controlt Select around the current type-definition.
  • Controlu Select around the current unit test.
  • Controlw Select around the current word.
  • ControlW Select around the current longword.
  • Control× Select around the closest matching pair of × characters.

The following bindings select the next or previous item, treating the Edit History and Jumplist as a stack (with the newest stuff on top):

  • ControlOptionb Select next block/paragraph.
  • ControlOptionB Select previous block/paragraph.
  • ControlOptionc Select next comment.
  • ControlOptionC Select previous comment.
  • ControlOptiond Select next diagnostic.
  • ControlOptionD Select previous diagnostic.
  • ControlOptione Select next edit/change.
  • ControlOptionE Select previous edit/change.
  • ControlOptionf Select next function.
  • ControlOptionF Select previous function.
  • ControlOptionh Advance (down) through the Edit History, selecting the next (older) entry.
  • ControlOptionH Regress (back up) through the Edit History, selecting the previous (newer) entry.
  • ControlOptionj Advance (down) through the Jumplist, selecting the next (older) entry.
  • ControlOptionJ Regress (back up) through the Jumplist, selecting the previous (newer) entry.
  • ControlOptionp Select next parameter/argument.
  • ControlOptionP Select previous parameter/argument.
  • ControlOptiont Select next type-definition.
  • ControlOptionT Select previous type-definition.
  • ControlOptionu Select next unit test
  • ControlOptionU Select previous unit test.
  • ControlOptionEnter Save selection to the Jumplist.

The Match Menu works fine, and I've created the last block of bindings (using the ControlOption chord) already, but I cannot create the two blocks before that (using the Control xor Option chord).

The commands exist, but they have no name to bind to.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: Improvements
Projects
None yet
Development

No branches or pull requests

3 participants