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

feat(which-key): Add option to not group items when parsing which-key.… #373

Merged
merged 1 commit into from
Jun 1, 2023

Conversation

mrjones2014
Copy link
Owner

…nvim tbls

Resolves: #372

How to Test

  1. Have which-key config with groups
  2. Enable which-key integration
  3. require('legendary').setup({ which_key = { use_groups = false } })
  4. legendary.nvim should not create item groups from the which-key groups

Testing for Regressions

I have tested the following:

  • Triggering keymaps from legendary.nvim in all modes (normal, insert, visual)
  • Creating keymaps via legendary.nvim, then triggering via the keymap in all modes (normal, insert, visual)
  • Triggering commands from legendary.nvim in all modes (normal, insert, visual)
  • Creating commands via legendary.nvim, then running the command manually from the command line
  • augroup/autocmds created through legendary.nvim work correctly

@mrjones2014
Copy link
Owner Author

mrjones2014 commented Jun 1, 2023

@PetitBandit mind giving this a test? You should be able to just set branch = 'mrj/372/whichkey-group-optional' on your plugin manager where you install the plugin.

I tested locally but I don't actually use which-key, I just have a contrived setup for testing, so I'd like to get a test from someone who actually uses which-key.

@mrjones2014 mrjones2014 changed the title feat(whichkey): Add option to not group items when parsing which-key.… feat(which-key): Add option to not group items when parsing which-key.… Jun 1, 2023
@PetitBandit
Copy link

I just tried it and i still get the groupname showing up and not the label of the command inside the groups.
this exemple:

y = {
   name = "config+", -- optional group name
   c = { "<cmd>lua require('plugins.telescope').search_color()<cr>", "colorscheme"}, 
   h = { ":CccHighlighterToggle<CR>", "highlight colors"}, 
   o = { 
     name = "options", 
        b = { "background" }, -- just a label. don't create any mapping
        h = { "hard times" }, 
        r = { "relative number" },
        w = { "wrap" }, 
   },
   p = {
     name = "plugins",
        i = { ":PlugInstall<cr>", "Install plugins"}, 
        c = { ":PlugClean<cr>", "clean plugins"}, 
        u = { ":PlugUpdate<cr>", "update plugins"}, 
   }
 },

in this exemple if i searched background in legendary it wouldnt show up, but configs (name of the group) would

@mrjones2014
Copy link
Owner Author

Did you set the new config.which_key.use_groups = false option? it is true by default, you will need to change it to disable grouping. It works for me when I copy your table:

image

@PetitBandit
Copy link

Works flawlessly, thank you so much 🔥

@mrjones2014 mrjones2014 merged commit 23acccf into master Jun 1, 2023
@mrjones2014 mrjones2014 deleted the mrj/372/whichkey-group-optional branch June 1, 2023 18:27
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.

[Feature]: Option to not use Whichkey groups
2 participants