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

Allow custom mappings in the "combine selections" menu #3572

Open
Screwtapello opened this issue Jun 29, 2020 · 0 comments
Open

Allow custom mappings in the "combine selections" menu #3572

Screwtapello opened this issue Jun 29, 2020 · 0 comments

Comments

@Screwtapello
Copy link
Contributor

Feature

The :mapcommand takes a "mode" argument that restricts the availability of the mapping. As well as the obvious modes (insert, normal) and some UI-based modes (prompt, menu, user) there's specific modes for the various normal-mode commands that are prefixes: goto, view, and object. A user can add a mapping (with a docstring) to those modes, and the mapping will show up alongside the built-in/official mappings, so plugins can extend Kakoune in a way that feels completely normal and familiar.

However, there's one normal-mode prefix that does not accept custom mappings: the "combine selections" menu that appears after you press <a-z> or <a-Z>.

The specific list of changes requested by this issue are:

  • the :map command should accept a new "mode" ("combine_selections"? "combsel"?) that represents the "combine selections" menu
  • mappings in the "combine_selections" mode should have access to the %val{count} and %val{register} expansions (like mappings in "object" do)
  • mappings will probably need an additional %val{combine_direction} expansion to distinguish between <a-z> (from register) and <a-Z> (to register)

Usecase

People coming to Kakoune for the first time frequently expect the "combine selections" menu to do mathematical-style set operations (union, intersection, left-subtraction, right-subtraction) on the set of selected characters:

However, the existing items in the combine selections menu don't work like that. There's good reasons why they don't work like that, but experimenting with different kinds of selection operations is difficult because they must be implemented in C++.

If custom mappings could be added to the "combine selections" menu, people could implement different selection operations themselves. If any of those experiments turned out to be particularly useful, they could be ported to C++ later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant