Closed gregorias closed 3 years ago
The problems stems from auto-pairs imapping Ctrl-P at two places: https://github.com/LunarWatcher/auto-pairs/blob/1763e83c95394f772d942f93a409f3e16fcc91d3/autoload/autopairs.vim#L728-L737
The problem can be mitigated by unmapping those settings globally with
let g:AutoPairsMoveExpression = ""
let g:AutoPairsShortcutMultilineClose = ""
in init.vim
.
I don't consider it a solution though. Ideally, those mappings could be defined per buffer and/or disabled per buffer, so that they can work in settings where their functionality is not needed.
That's a side-effect of the prefix I ended up using. Telescope declares <C-p>
, auto-pairs declares <C-p><additional keybind>
, meaning Vim will wait for further input after <C-p>
to check if you meant <C-p>
or <C-p>something else
.
Making the maps buffer-specific isn't really hard, but this is a massive side-effect of #34 - I have no idea why Telescope triggers auto-pairs for you at all. In fact, auto-pairs doesn't normally load in popup buffers (or terminal buffers), which means no load, no auto-pairs, and no keybinds like that one load.
Also worth noting that you're using legacy maps - all the keybinds have a ctrl alternative, most of which start with <C-p>
because I thought a prefix made sense. I'm probably gonna have to revisit the specifics, but as for telescope, this shouldn't happen because it shouldn't load in the first place. That's a discussion for #34, however
That being said, I can still add buffer variables for the mappings, but I'm not entirely sure about the actual practical usefulness of it if it's largely for a single buffer where it, again, shouldn't load.
Using the <C-p>
as the prefix is fine.
I think the issue stands regardless of #34. The reason for that is that if those mapping are not buffer specific but global, then it doesn't matter that auto-pairs doesn't function in telescope's prompt. Those mappings will still exist and every time I press <C-p>
, Vim will wait for further input after <C-p>
.
This isn't entirely fixed yet. It's done for all the keybinds, except g:AutoPairsShortcutMultilineClose
, which I need to rework (#32) before I can make it a buffer variable. g:AutoPairsMoveExpression
already has a buffer variable - see the documentation before setting it, though.
g:AutoPairsMoveExpression
already had a buffer variable - see the documentation before setting it, though.
Indeed, thanks. I didn't noticed it and assumed it was global.
That should be everything migrated, and respecting the new options -- there were a couple typos in the first round where the if statement checked the buffer variant, but the keybinds mapped the global variant :sweat_smile:
I had to disable all shortcuts one by one to fix this
vim.g.AutoPairsCompatibleMaps = 0
vim.g.AutoPairsMapBS = 1
vim.g.AutoPairsShortcutToggle = ""
vim.g.AutoPairsShortcutFastWrap = ""
vim.g.AutoPairsShortcutJump = ""
vim.g.AutoPairsShortcutBackInsert = ""
vim.g.AutoPairsMoveExpression = ""
vim.g.AutoPairsShortcutIgnore = ""
vim.g.AutoPairsShortcutToggleMultilineClose = ""
@arashm Auto-pairs shouldn't be starting in telescope buffers at all. If it's doing that again, this bug has regressed. If not, the standard conflict issue still remains, and that's a well-known problem I haven't bothered fixing because everything seems to conflict, and finding free keys in insert mode is a nightmare
@LunarWatcher This is VIM's normal behaviour, I believe. <C-p>
is a global mapping that invokes Telescope's window. Since auto-pairs adds a <C-p><C-r>
(or something else) mapping, when pressing <C-p>
, vim adds a debounce/delay to give time to user to press other keys if needed. This is true for all mappings.
I think it would have been better not to have any default mappings and give the user the responsibility to define them if they need them.
For future reference:
I was experiencing the same delay when using a <c-p>
mapping to invoke FZF . Adapting @arashm's answer to vim syntax solved the problem for me.
For anyone wanting a copy-paste solution in vim-script to unbind all the ctrl-p mappings:
let g:AutoPairsMoveCharacter = "" let g:AutoPairsCompatibleMaps = 0 let g:AutoPairsMapBS = 1 let g:AutoPairsShortcutToggle = "" let g:AutoPairsShortcutFastWrap = "" let g:AutoPairsShortcutJump = "" let g:AutoPairsShortcutBackInsert = "" let g:AutoPairsShortcutIgnore = "" let g:AutoPairsShortcutToggleMultilineClose = ""
It's enough to unbind only these three
in order to remove <c-p>
lag
let g:AutoPairsShortcutToggle = ""
let g:AutoPairsShortcutJump = ""
let g:AutoPairsShortcutToggleMultilineClose = ""
Thanks for snippets @pooriajr, @arashm
There's also g:AutoPairsPrefix
to change the prefix from ctrl-p
OS: Manjaro What vim?: Neovim 0.5
Describe the bug When you press
<Ctrl-P>
in Telescope, Telescope moves up one row but only after a noticeable delay. The delay seems to be only present when auto-pairs is installed.Steps to reproduce
Telescope
:Telescope
, for example)<C-P>
Telescope will move up one row but only after some time (~half a second). Without the auto-pairs plugin,
<C-P>
is instantaneous.