Problem: Keys valid in CTRL-X mode are never mapped while insert
completion is active, so <C-N>/<C-P> cannot be remapped for
completion started by complete().
Solution: Do not disable mappings in CTRL_X_EVAL mode. In this mode a
mapping cannot interfere with selecting the completion
method, which is what the no-mapping rule exists for.
related: #6440
related: #16880
https://github.com/vim/vim/pull/20489
(6 files)
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.![]()
Here the potential more general fix:
diffdiff --git a/src/getchar.c b/src/getchar.c index d02b9009c..1231829b8 100644 --- a/src/getchar.c +++ b/src/getchar.c @@ -2733,8 +2733,9 @@ at_ins_compl_key(void) // to the CTRL-N/CTRL-P completion keys here. && !(p[2] & MOD_MASK_SHIFT)) c = p[3] & 0x1f; - return (ctrl_x_mode_not_default() && vim_is_ctrl_x_key(c)) - || (compl_status_local() && (c == Ctrl_N || c == Ctrl_P)); + return (!ins_compl_active() || ctrl_x_mode_selecting()) + && ((ctrl_x_mode_not_default() && vim_is_ctrl_x_key(c)) + || (compl_status_local() && (c == Ctrl_N || c == Ctrl_P))); } /* diff --git a/src/insexpand.c b/src/insexpand.c index bbb15b003..d48c1b859 100644 --- a/src/insexpand.c +++ b/src/insexpand.c @@ -385,6 +385,17 @@ ctrl_x_mode_not_defined_yet(void) return ctrl_x_mode == CTRL_X_NOT_DEFINED_YET; } +/* + * Return TRUE when the next typed key selects the completion method: right + * after CTRL-X, or after CTRL-X CTRL-V CTRL-X. + */ + int +ctrl_x_mode_selecting(void) +{ + return ctrl_x_mode == CTRL_X_NOT_DEFINED_YET + || ctrl_x_mode == CTRL_X_CMDLINE_CTRL_X; +} + /* * Return TRUE if currently in "normal" or "adding" insert completion matches * state diff --git a/src/proto/insexpand.pro b/src/proto/insexpand.pro index e973eac4f..bbc4a9810 100644 --- a/src/proto/insexpand.pro +++ b/src/proto/insexpand.pro @@ -18,6 +18,7 @@ int ctrl_x_mode_line_or_eval(void); int ctrl_x_mode_register(void); int ctrl_x_mode_not_default(void); int ctrl_x_mode_not_defined_yet(void); +int ctrl_x_mode_selecting(void); int compl_status_adding(void); int compl_status_sol(void); int compl_status_local(void);
This makes the existing Test_compl_ignore_mappings in src/testdir/test_popup.vim fail, but this might be acceptable.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.![]()