From 29517d95b74bec4e02ec75e6720a55671ead6529 Mon Sep 17 00:00:00 2001 From: Björn Linse Date: Fri, 10 Dec 2021 17:35:06 +0100 Subject: refactor(misc1): move insertmode related function to edit.c --- src/nvim/edit.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/nvim/edit.c') diff --git a/src/nvim/edit.c b/src/nvim/edit.c index 9bfb8a9d4a..424b6b40b1 100644 --- a/src/nvim/edit.c +++ b/src/nvim/edit.c @@ -832,6 +832,16 @@ static int insert_execute(VimState *state, int key) return insert_handle_key(s); } + +/// Return true when need to go to Insert mode because of 'insertmode'. +/// +/// Don't do this when still processing a command or a mapping. +/// Don't do this when inside a ":normal" command. +bool goto_im(void) +{ + return p_im && stuff_empty() && typebuf_typed(); +} + static int insert_handle_key(InsertState *s) { // The big switch to handle a character in insert mode. -- cgit