which-key.nvim
which-key.nvim copied to clipboard
feat: Allow mapped lua functions to have arguments
With a lot of lua plugins it is quite common to have bindings that call a lua function which can take some additional options. It would be nice if these arguments could be stored together with the function. Then upon invoking the mapping, the arguments could be unpacked and forwarded to the function. I think having an option called args that holds the arguments as an array would be a nice improvement.
One could then do
["<Leader>ff"] = { require"telescope.builtin".find_files, args = { require"telescope.themes".get_ivy() }, "Find files, but with ivy-theme" }
instead of
["<Leader>ff"] = { function() require"telescope.builtin".find_files(require"telescope.themes".get_ivy()) end, "Find files, but with ivy-theme" }
Sorry, I'm not a fan of this. I'd rather keep it simple and similar to the vim.keymap api.
Thank you for the suggestion though!