Andrew Stewart wrote: > I posted this question a while back on vim_use but didn't receive any > replies so I thought I would try here. > > https://groups.google.com/forum/#!topic/vim_use/EsISt5b-tnM/discussion > > 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.)
Would it be sufficient to not trigger CursorMovedI when the user pressed CTRL-X ? What submode would it be in? Or are you saying that this depends on whether the completion uses a popup menu or not? I suppose we could limit CursorMovedI to when Vim is waiting for a character to be inserted, not in some submode where behavior is unpredictable. However, some completion plugins may actually use the side-efffect. -- "A mouse can be just as dangerous as a bullet or a bomb." (US Representative Lamar Smith, R-Texas) /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org /// -- -- You received this message from the "vim_dev" 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_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.