How to detect i_CTRL-X submode in Vimscript?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

How to detect i_CTRL-X submode in Vimscript?

Andrew Stewart
Hello!

I have a CursorMovedI autocommand which runs some Vimscript.  Unfortunately if the user is in the CTRL-X submode (of insert mode) when the autocommand fires, when the Vimscript finishes the user is left in normal mode.  This doesn't happen if the completion popup is already visible; only if the user has invoked the submode but done nothing further.

I'm assuming it's not possible to avoid the submode being exited during the course of the Vimscript execution.  So I'd like to detect this situation and then restore the mode at the end of the Vimscript.

How then can I detect if the user is in the i_CTRL-X submode?  (The mode() function doesn't tell me.)

Many thanks in advance,

Andrew Stewart

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.