-
Notifications
You must be signed in to change notification settings - Fork 322
feat(keymap)!: replace expr keymaps with normalized feedkeys execution #2266
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
base: main
Are you sure you want to change the base?
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
|
Does calling |
|
Thanks for the feedback, you give me some additional thinking! I'd like to explore this approach a bit more. The Edit: Updated PR description |
|
Wow this is quite a bit of work, you'd end up fixing all the major issues with keymaps! These changes would be breaking, since theyre no longer Fyi, I got a bit ambitious with v2 so I'm going to reduce its scope. Just planning some light refactoring, these keymap changes, source-per-LSP, adopt blink.lib, and the improved API (for keymaps, enable, vim.g, dynamic config, etc) |
|
Yeah, as long as I'm here, I might as well fix these issues once and for all. I've had promising results locally. I don't mind working on this for v2, but last time I switched to this branch, everything was so broken that it was hard to make any convincing commits. Feel free to keep in touch on Matrix to coordinate! |
094bc69 to
fec6db0
Compare
This change introduces: - multi-key sequence support (e.g. `<C-x><C-o>`) - normalized key comparison and equivalence (`<C-i>` == `<Tab>`) - key composition from user callbacks - fallback handling, including `<Plug>`, `<SID>`, and script mappings - automatic reapplication of missing (stolen) buffer keymaps Keymaps are now buffer-local for all modes, rely on normalized key notation instead of termcodes, and execute commands eagerly until one succeeds. BREAKING CHANGE: Keymap execution semantics, fallback behavior, and mapping scope have changed. expr mappings are no longer used.
fec6db0 to
c855892
Compare
Revamp keymap handling by moving away from expr mappings to a normalized feedkeys approach, fixing several long-standing edge cases around multi-key mappings, fallbacks, and interoperability with other plugins.
Issue: keymap ['<C-x><C-o>'] = { 'show' } does not work #453
{ ['jk'] = { 'hide', 'fallback' }, ['<C-x><C-o>'] = { 'show', 'fallback' }, ['<Leader>cc'] = { 'show', 'fallback' }, }Issue: Extended Keys (<C-i>, <C-m>) for keymaps #2119
{ ['<C-n>'] = { 'select_next' }, ['<Tab>'] = { function() return '' end, -- would fallback function() return '<C-n>' end, -- would call `select_next` }, },<SNR>,<SID>,<Plug>Issue: Keymap fallback doesn't handle
scriptmappings #714Issue:
{ "select_accept_and_enter", "fallback" }Does not trigger abbreviations in cmdline #2263Issue: bug(snippets): jump not triggered unless user have entered insert mode before #2164
Issue: Keymap not work with plugin vim-visual-multi #406
Issue: More Detailed Descriptions for Preset Keymaps #2281
keymapmodule as simply as possibleexpr,vim.schedulein all commands and return boolean value from the function itself:Issue: Documentation bug: keymap commands function examples missing return #2182