Skip to content

Commit b61431c

Browse files
njhoffmandivramod
andcommitted
fix: register cmdline mappings synchronously on CmdlineEnter
Split the combined CmdlineEnter/InsertEnter subscription so that CmdlineEnter runs the handler directly instead of through async.debounce_next_tick. Deferring to the next tick can land after mode detection has shifted, leaving cmp.core:prepare() unable to register cmdline mappings while is_cmdline_mode() still returns true. Partial port of upstream PR hrsh7th#2214 (hrsh7th#2214). The PR's other change (reordering config merges in lua/cmp/config.lua) was intentionally NOT applied: misc.merge resolves leaf collisions in favor of its first argument, so the original order is what makes onetime / cmdline / filetype / buffer override global. Adopting the PR's reordering would invert the documented priority. Co-authored-by: Arvid Petermann <arvidpetermann@googlemail.com>
1 parent 9ed2af6 commit b61431c

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## [0.1.2](https://github.com/njhoffman/nvim-cmp/compare/v0.1.1...v0.1.2) (2026-04-25)
4+
5+
### Bug Fixes
6+
7+
- run the `CmdlineEnter` handler synchronously so `cmp.core:prepare()` registers cmdline mappings while `is_cmdline_mode()` still returns true (partial port of upstream [#2214](https://github.com/hrsh7th/nvim-cmp/pull/2214)). The PR's other change (config merge order) was deliberately not applied — it inverts the documented `onetime > cmdline > filetype > buffer > global` priority because `misc.merge` resolves leaf collisions in favor of `tbl1`, not `tbl2`.
8+
39
## [0.1.1](https://github.com/njhoffman/nvim-cmp/compare/v0.1.0...v0.1.1) (2026-04-25)
410

511
### Bug Fixes

lua/cmp/autocmds.lua

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@ local setup = function(cmp)
1212
cmp.core:on_change('InsertEnter')
1313
end
1414
end
15-
autocmd.subscribe({ 'CmdlineEnter', 'InsertEnter' }, async.debounce_next_tick(on_insert_enter))
15+
-- CmdlineEnter runs synchronously so cmp.core:prepare() registers cmdline
16+
-- mappings while is_cmdline_mode() still returns true; the next-tick defer
17+
-- used for InsertEnter loses that window.
18+
autocmd.subscribe('CmdlineEnter', on_insert_enter)
19+
autocmd.subscribe('InsertEnter', async.debounce_next_tick(on_insert_enter))
1620

1721
local on_text_changed = function()
1822
if config.enabled() then

0 commit comments

Comments
 (0)