Fix the problem of key bindings in finder buffers#4122
Fix the problem of key bindings in finder buffers#4122Shuangcheng-Ni wants to merge 1 commit intoycm-core:masterfrom
Conversation
puremourning
left a comment
There was a problem hiding this comment.
Thanks for making a PR, but I'm not sure this is the way to go. I'm not sure that we really want to remove user mappings.
Is the issue you experienced due to the <C-r>= part ? I.e. CmdWinEnter could be used to disable YCM closing the popup. Or perhaps there's a way to detect if we're halfway a mapping when the bufleave event happens.
This seems more likely to cause problems than solve them IMO.
In any case, we'd need extensive test for this change if we were to merge it (as it's complex, and fiddly).
Reviewable status: 0 of 2 LGTMs obtained
|
The new mappings defined in my additional code are buffer-local mappings and only works in the finder buffer. They do not affect other buffers. They are just used to override the global mappings in the finder buffer and make each key sequence take its original form. |
PR Prelude
Thank you for working on YCM! :)
Please complete these steps and check these boxes (by putting an
xinsidethe brackets) before filing your PR:
rationale for why I haven't.
actually perform all of these steps.
Why this change is necessary and useful
As we discussed on gitter, some extra insert-mode key bindings might dismiss the finder buffer. For example, if a user has something like
inoremap <BS> <C-r>=auto_pair()<CR>in his/her.vimrc, the finder buffer would immediately disappear after pressing<BS>.This commit fixes the problem. It tries to override all the global mappings with some buffer-local mappings that remap each previously mapped key sequence to itself in the finder buffer, while the previously defined buffer-local mappings in the finder buffer are not overridden.
[Please explain in detail why the changes in this PR are needed.]
This change is