-
-
Notifications
You must be signed in to change notification settings - Fork 163
Enable mappings for different modes #268
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
Enable mappings for different modes #268
Conversation
lua/orgmode/config/init.lua
Outdated
if type(keys) == 'string' then | ||
keys = { keys } | ||
local map = {} | ||
if #mappings[category][name] == 0 then -- we are in a multi-mode mapping |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should use this check:
type(mappings[category][name]) == 'table' and not vim.tbl_islist(mappings[category][name])
Because we have situation where we have a mapping that is a table list, but is actually a single normal mapping with an additional parameter, like this one
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I'm not mistaken that example should work regardless, because it should still go into the else branch (since the length operator would return non-zero) 🤔 But you are absolutely right, my check is ugly and I just didn't know how to do it properly 😁 Thanks a lot, will add the change :)
7703088
to
122149b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good now. You will cover the other options also in this PR?
Yes, should find time for it this week |
@kristijanhusak we could make the first mapping equal to |
@jgollenz yeah, do that. More consistent is better. |
3d3d8a9
to
0a85f4a
Compare
0a85f4a
to
f1fe5f2
Compare
@kristijanhusak sorry, it took a while. Should be working now |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks!
This PR adds support for mappings in other modes than normal-mode, as discussed in #249 .
@kristijanhusak fyi I'm still working on the part concerning your
vim.keymap.set
example ;)