aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/getchar.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/getchar.c')
-rw-r--r--src/nvim/getchar.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/nvim/getchar.c b/src/nvim/getchar.c
index 538ebf7978..b0d06b7a30 100644
--- a/src/nvim/getchar.c
+++ b/src/nvim/getchar.c
@@ -2230,20 +2230,22 @@ static int vgetorpeek(bool advance)
timedout = true;
continue;
}
- /* When 'insertmode' is set, ESC just beeps in Insert
- * mode. Use CTRL-L to make edit() return.
- * For the command line only CTRL-C always breaks it.
- * For the cmdline window: Alternate between ESC and
- * CTRL-C: ESC for most situations and CTRL-C to close the
- * cmdline window. */
- if (p_im && (State & INSERT))
+ // When 'insertmode' is set, ESC just beeps in Insert
+ // mode. Use CTRL-L to make edit() return.
+ // In Ex-mode \n is compatible with original Vim behaviour.
+ // For the command line only CTRL-C always breaks it.
+ // For the cmdline window: Alternate between ESC and
+ // CTRL-C: ESC for most situations and CTRL-C to close the
+ // cmdline window.
+ if (p_im && (State & INSERT)) {
c = Ctrl_L;
- else if ((State & CMDLINE)
- || (cmdwin_type > 0 && tc == ESC)
- )
+ } else if (exmode_active) {
+ c = '\n';
+ } else if ((State & CMDLINE) || (cmdwin_type > 0 && tc == ESC)) {
c = Ctrl_C;
- else
+ } else {
c = ESC;
+ }
tc = c;
break;
}