When logging autocommand events, I came across a few ones that seem a bit strange:

  1. User -- seems to be logged very frequently, though the vim help really only mentions "it's not a real event and only executed by :doautocmd. What is this event, and when/why would it be fired?
  2. SafeState, SafeStateAgain -- these seem to be the most commonly invoked event types. Vim says this means 'When nothing is pending' -- why would this event be needed then? That is, what could it be used for / why would an autocmd ever use it?
  3. CmdlineChange -- This is invoked ad nausem on any undo function, For example pressing u (see image below). Why this this invoked so frequently on undo?

enter image description here

  1. CursorHold -- I get this occassionally (CursorMoved seems much more clear/consistent). It seems to be invoked if I don't move my cursor for ~5s, but that's not really a precise picture of it. Does this keep firing every 5s (or whatever time-frame this is), or is it only fired once?

  2. Finally, when logging these events the help section is blank! Why does that occur? Here is a 15-second video of what the help-section looks like when I have logged on: https://gyazo.com/5fa1e1e7907c8cb4b3a5bbdf1574c82e.

  • 1
    Have you already read the help for each of these events (:h User and so on) before asking a question? Have you tried to do the same with your plugins disabled? – Matt Jun 28 at 4:39
  • CursorHold is controlled by a setting. User is used by plugins to create hooks – D. Ben Knoble Jun 28 at 11:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.