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: add popup_user_mappings option #367

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

younger-1
Copy link

Summary

This PR add a WK option popup_user_mappings (table: string -> function).

With this option, user can binding key to function inside the WK popup.

The user-defined function accepts two parameter (keys, mode) , in which keys is the keys bring up WK popup, mode is the current vim mode.

Use case

my use case is to fuzzy find the keymaps with above keys as a prefix.
For example to mimic emacs' <C-h>, with Telescope keymaps :

  popup_user_mappings = {
    ['<C-h>'] = function(key, mode)
      require('telescope.builtin').keymaps {
        modes = { mode },
        lhs_filter = function(lhs)
          return vim.startswith(lhs, key)
        end,
      }
    end,
  },

b

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.

None yet

1 participant