fix keymap retrigger in operator mode
should fix #286.
I did already fix that, no?
I use mini.ai myself with those keybiondings and it works as expected
yes, you fixed the main problem. However consider this case:
- you have the string
"hello" - if you try to
ciwwith the cursor on the characterh, you'll actually end up performing the action on the previous character"which happens to be a word in vim
I suspect this happens because c operator enters insert mode so when you retrigger to re-enter normal mode, the cursor shifts backwards by one position.
Thank you for the clarification. Will need to check this PR with some issues from the past related to keymaps.
I'm also not that sure of the vim.schedule in there
Yeah. I agree with the sentiment about using vim.schedule.
~~I've got another solution via this branch which uses expr and remap to retrigger the original keymap.~~
Edit: I've figured out a better solution for the retrigger logic
I implemented the solution you propose a while back, but it failed some issues people had in the past. Although, I did not add that <ignore>.
What I'll do first, I'll add a bunch of unit tests for those issues I'm talking about, so we have something to test this with. Will do so on Monday.
Understood. From my various "tests" it works pretty well:
- loading multiple plugins with one keymap. e.g
gzaiw[char]loadsmini.surroundthenmini.aifor me - count works as expected
yes, you fixed the main problem. However consider this case:
- you have the string
"hello"- if you try to
ciwwith the cursor on the characterh, you'll actually end up performing the action on the previous character"which happens to be a word in vimI suspect this happens because
coperator enters insert mode so when you retrigger to re-enter normal mode, the cursor shifts backwards by one position.
When will this pr be merged? I also encountered this issue.
I still need to check existing issues related to keymaps and make sure they still work as expected. If you want to help, add a comment to this PR linking to existing issues I should re-check with this PR
AFAICT, these are the more relevant issues regarding the keys handler:
- #308
- #307
- #286
- #252
- #71
- #28
All of these seems to be fixed using neovim master but not on neovim stable (0.8.x). Particularly:
- keys need to be pressed twice(sometimes)
- Upon opening neovim, When I perform any(literally) action, subsequent registered keys need to be pressed twice to trigger
- keys are pasted when triggering in visual mode.
ok, thanks. I'll try to look into it later today. I do think the pending keys probably need to be added to your PR, but I'll see if it's needed when I encounter issues
I checked all existing issues and these changes indeed seem to work for all of them. Thanks for fixing this!
Happy to help! Though I did mention that there were some issues with neovim stable. Were you able to verify this?
It all seemed to work for me on stable. What issue in particular didnt work on stable for you?
This one seems to work on nightly, but not on stable. https://github.com/folke/lazy.nvim/issues/511
Will look into it