Is there a way to run a function when entering i_CTRL-X (ins-completion) mode? It doesn't seem to be an event I can run an autocmd for?

I can just imap C-S-x (say) to run my function and then call C-x. And there is CompleteDone event for leaving. But it would be nicer if there was an event for entering this mode as well.

Context: I want to use ins-completion to complete text involving braces and other brackets. Adding these things to iskeyword breaks many text objects and pattern matching. So I would like to modify iskeyword when entering and leaving this mode.

I work with small enough files that I don't need to worry about the lag when vim re-processes the file.

  • Did you consider perusing :help autocommand-events?
    – romainl
    Commented Oct 18, 2023 at 20:02
  • 1
    Couldn't spot one there. I'm a bit of a noob so I may have missed it. Commented Oct 18, 2023 at 20:06


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.