summaryrefslogtreecommitdiffstats
path: root/src/normal.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/normal.c')
-rw-r--r--src/normal.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/normal.c b/src/normal.c
index 0f95728c31..d367318122 100644
--- a/src/normal.c
+++ b/src/normal.c
@@ -172,6 +172,9 @@ static void nv_nbcmd __ARGS((cmdarg_T *cap));
#ifdef FEAT_DND
static void nv_drop __ARGS((cmdarg_T *cap));
#endif
+#ifdef FEAT_AUTOCMD
+static void nv_cursorhold __ARGS((cmdarg_T *cap));
+#endif
/*
* Function to be called for a Normal or Visual mode command.
@@ -434,6 +437,9 @@ static const struct nv_cmd
#ifdef FEAT_DND
{K_DROP, nv_drop, NV_STS, 0},
#endif
+#ifdef FEAT_AUTOCMD
+ {K_CURSORHOLD, nv_cursorhold, 0, 0},
+#endif
};
/* Number of commands in nv_cmds[]. */
@@ -1077,6 +1083,9 @@ getcount:
if (need_flushbuf)
out_flush();
#endif
+#ifdef FEAT_AUTOCMD
+ did_cursorhold = FALSE;
+#endif
State = NORMAL;
@@ -8652,3 +8661,20 @@ nv_drop(cap)
do_put('~', BACKWARD, 1L, PUT_CURSEND);
}
#endif
+
+#ifdef FEAT_AUTOCMD
+/*
+ * Trigger CursorHold event.
+ * When waiting for a character for 'updatetime' K_CURSORHOLD is put in the
+ * input buffer. "did_cursorhold" is set to avoid retriggering.
+ */
+/*ARGSUSED*/
+ static void
+nv_cursorhold(cap)
+ cmdarg_T *cap;
+{
+ apply_autocmds(EVENT_CURSORHOLD, NULL, NULL, FALSE, curbuf);
+ did_cursorhold = TRUE;
+}
+#endif
+