Skip to content

Add support for grouped keys#1063

Open
musjj wants to merge 2 commits into
wbthomason:masterfrom
musjj:patch-1
Open

Add support for grouped keys#1063
musjj wants to merge 2 commits into
wbthomason:masterfrom
musjj:patch-1

Conversation

@musjj

@musjj musjj commented Sep 10, 2022

Copy link
Copy Markdown

If you have a lot of keys that you want to use for lazy loading, your config can become a bit hairy:

use {
  "FooBar/Baz",
  keys = {
    { "n", "a" },
    { "n", "b" },
    { "n", "c" },
    { "n", "d" },
    { "v", "e" },
    { "v", "f" },
    { "v", "g" },
    { "v", "h" },
  },
}

With this PR, you can now instead group your keys like this:

use {
  "FooBar/Baz",
  keys = {
    n = { "a", "b", "c", "d" },
    v = { "e", "f", "g", "h" },
  },
}

@musjj

musjj commented Dec 12, 2022

Copy link
Copy Markdown
Author

Anything blocking this from getting merged?
To clarify, this PR is backwards-compatible with the original way of specifying keys.

@wbthomason wbthomason left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Sorry for not seeing this before now. I think this is mostly good to go, but the updated language in the docs is technically incorrect, so we need to fix that before merging.

I'll have limited internet for the next week, but please @ me if you get to this and I haven't responded by Dec 21.

Comment thread README.md Outdated
#### Keybindings

Plugins may be lazy-loaded on the use of keybindings/maps. Individual keybindings are specified either as a string (in which case they are treated as normal mode maps) or a table in the format `{mode, map}`.
Plugins may be lazy-loaded on the use of keybindings/maps. Individual keybindings are specified either as a string (in which case they are treated as normal mode maps) or a table in one of the following formats:

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here and in the doc/ file, we need to change the wording a bit. It currently only talks about individual keybindings, but we want to say that you can specify the whole set of keybindings in one of these two table formats, not individual keybindings.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the late reply! Do you think they're clearer now?

@XXiaoA

XXiaoA commented Dec 16, 2022

Copy link
Copy Markdown

Hey @musjj! thanks for your great PR, which I really need. Therefore, when will we fix the docs?🤗

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants