Skip to content

Preserve noremap when restoring abbreviation mappings - #539

Open
azusa0612 wants to merge 2 commits into
Julian:mainfrom
azusa0612:agent/preserve-abbreviation-noremap
Open

Preserve noremap when restoring abbreviation mappings#539
azusa0612 wants to merge 2 commits into
Julian:mainfrom
azusa0612:agent/preserve-abbreviation-noremap

Conversation

@azusa0612

Copy link
Copy Markdown

Summary

  • preserve noremap when restoring insert-mode mappings after Unicode abbreviation input
  • assert that an existing non-recursive Lua mapping remains non-recursive

Why

Unicode abbreviation handling temporarily replaces <CR> and <Tab>, then recreates the previous mappings. The recreation preserved several mapping attributes, including desc, but dropped noremap.

That can turn a non-recursive completion fallback mapping into a recursive one. With blink.cmp and nvim-autopairs, pressing Enter after entering a Lean abbreviation can then re-enter the same fallback mapping until Neovim overflows its stack or hangs.

This completes the mapping restoration addressed in #367 and fixes a recurrence of the symptom reported in saghen/blink.cmp#441.

Validation

  • just retest spec/abbreviations/abbreviations_spec.lua with unwrapped Neovim: 14 passed
  • StyLua check passed
  • Luacheck: 0 warnings / 0 errors
  • Selene: 0 errors
  • manual reproduction on Neovim 0.12.2 with blink.cmp 1.10.2 and nvim-autopairs 0.10.0: \or , type (, then press Enter inside (); the mapping is restored with noremap=1 and Enter inserts a newline normally

@azusa0612
azusa0612 marked this pull request as ready for review July 30, 2026 19:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant