summaryrefslogtreecommitdiff
path: root/editors/vi.c
diff options
context:
space:
mode:
Diffstat (limited to 'editors/vi.c')
-rw-r--r--editors/vi.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/editors/vi.c b/editors/vi.c
index 6fa0a4e..5b86b05 100644
--- a/editors/vi.c
+++ b/editors/vi.c
@@ -2227,7 +2227,10 @@ static char *char_insert(char *p, char c, int undo) // insert the char c at 'p'
p--; // open above, indent before newly inserted NL
if (len) {
- indentcol = col;
+ // only record indent if in insert/replace mode or for
+ // the 'o'/'O' commands, which are switched to insert
+ // mode early.
+ indentcol = cmd_mode != 0 ? col : 0;
if (expandtab) {
ntab = 0;
nspc = col;
@@ -4265,6 +4268,9 @@ static void do_cmd(int c)
case 'o': // o- open an empty line below
dot_end();
dc3:
+#if ENABLE_FEATURE_VI_SETOPTS
+ cmd_mode = 1; // switch to insert mode early
+#endif
dot = char_insert(dot, '\n', ALLOW_UNDO);
if (c == 'O' && !autoindent) {
// done in char_insert() for 'O'+autoindent