summaryrefslogtreecommitdiff
path: root/src/edit.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2004-06-30 16:16:41 +0000
committerBram Moolenaar <Bram@vim.org>2004-06-30 16:16:41 +0000
commit843ee41eb8258ac50ed81976757d8b228382a880 (patch)
treed0fcdff9e19b05b182de1bb1be46b2e6f5b8b0b7 /src/edit.c
parentf4b8e57ffd048f9ca46dd7618939ba7a1b2294ec (diff)
downloadvim-843ee41eb8258ac50ed81976757d8b228382a880.zip
updated for version 7.0003
Diffstat (limited to 'src/edit.c')
-rw-r--r--src/edit.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/edit.c b/src/edit.c
index 7619a5555..1adcda414 100644
--- a/src/edit.c
+++ b/src/edit.c
@@ -270,6 +270,23 @@ edit(cmdchar, startln, count)
ins_compl_clear(); /* clear stuff for CTRL-X mode */
#endif
+#ifdef FEAT_AUTOCMD
+ /*
+ * Trigger InsertEnter autocommands. Do not do this for "r<CR>" or "grx".
+ */
+ if (cmdchar != 'r' && cmdchar != 'v')
+ {
+ if (cmdchar == 'R')
+ ptr = (char_u *)"r";
+ else if (cmdchar == 'V')
+ ptr = (char_u *)"v";
+ else
+ ptr = (char_u *)"i";
+ set_vim_var_string(VV_INSERTMODE, ptr, 1);
+ apply_autocmds(EVENT_INSERTENTER, NULL, NULL, FALSE, curbuf);
+ }
+#endif
+
#ifdef FEAT_MOUSE
/*
* When doing a paste with the middle mouse button, Insstart is set to
@@ -725,6 +742,12 @@ edit(cmdchar, startln, count)
break;
}
#endif
+#ifdef FEAT_AUTOCMD
+ set_vim_var_string(VV_INSERTMODE,
+ (char_u *)((State & REPLACE_FLAG) ? "i" :
+ replaceState == VREPLACE ? "v" : "r"), 1);
+ apply_autocmds(EVENT_INSERTCHANGE, NULL, NULL, FALSE, curbuf);
+#endif
if (State & REPLACE_FLAG)
State = INSERT | (State & LANGMAP);
else
@@ -859,7 +882,14 @@ doESCkey:
o_lnum = curwin->w_cursor.lnum;
if (ins_esc(&count, cmdchar))
+ {
+#ifdef FEAT_AUTOCMD
+ if (cmdchar != 'r' && cmdchar != 'v')
+ apply_autocmds(EVENT_INSERTLEAVE, NULL, NULL,
+ FALSE, curbuf);
+#endif
return (c == Ctrl_O);
+ }
continue;
/*