Replies: 1 comment
-
I don't understand why you need them predefined... maybe, just define maps only when you need them(?): vim.api.nvim_create_autocmd({...},{
-- extension pattern is an obvious take her, but there might be other options
pattern = '*',
callback = function()
-- here you call, for example,
require 'which-key'.register(maps, opts)
end,
}) You can also do a similar thing to UNregister them. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm trying to set pretty labels for plugin commands that are only available under certain conditions, like a filetype or a mode, but whenever I register just the label, it shows up regardless of whether it actually does anything. Example with nvim-orgmode:
![UFpvwshlZVJp](https://private-user-images.githubusercontent.com/237855/310368820-aa1eca80-de5d-4e0d-8cfc-4dcc91b205cd.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjE1MzQ0OTYsIm5iZiI6MTcyMTUzNDE5NiwicGF0aCI6Ii8yMzc4NTUvMzEwMzY4ODIwLWFhMWVjYTgwLWRlNWQtNGUwZC04Y2ZjLTRkY2M5MWIyMDVjZC5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwNzIxJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDcyMVQwMzU2MzZaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0zMzU4ODkxYWIwY2UwNDQxMmI5ZWRmMGExOGE2N2RjNGQyM2NkOWEyM2JmMDU4ZjEyOTgwN2QyZDhiYzlhZTQwJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.gIcNzhBcU6KzB68siCfHfCk3G9csO5z6jXzEbX-nNDM)
![EZPR3n1M08du](https://private-user-images.githubusercontent.com/237855/310369048-51483aa4-12f6-420d-a243-3d03133906f3.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjE1MzQ0OTYsIm5iZiI6MTcyMTUzNDE5NiwicGF0aCI6Ii8yMzc4NTUvMzEwMzY5MDQ4LTUxNDgzYWE0LTEyZjYtNDIwZC1hMjQzLTNkMDMxMzM5MDZmMy5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwNzIxJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDcyMVQwMzU2MzZaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT02NWYwMjUxMmY5NmFkZGZjODk0MDVmZjRhODQ3MWE1N2NlM2ZhOGMzMWNmMTdkNWE4MDJlNzY1Nzk5NGZjOThlJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.FrIHjbSpn33nHg8PbyHvy3lQfQizW9aTED09yWnqKko)
this shows up like this:
"Insert" here (i.e. not inside a .org file) doesn't do anything, and in fact would trigger an error if I pressed it.
Beta Was this translation helpful? Give feedback.
All reactions