While searching for autocommands event I noticed that there are no SourcePost event. This is strange, because nearly all of other event have a Post version of it (e.g. FileAppendPost, BufWritePost, ... ).

Do you know the reason behind this ?

  • It was probably not needed when creating it Aug 27, 2015 at 8:15
  • Maybe because you can exit Vim by sourcing?
    – muru
    Aug 27, 2015 at 8:44
  • @muru: what do you mean ?
    – nobe4
    Aug 27, 2015 at 8:53
  • 1
    @Nobe4 if I have wqa! in a file and I source it, Vim will quit, right? With most other events, it's quite unlikely that Vim will exit unless there's a fatal error. So there's no way to be reasonably sure if Vim can get commands to run after sourcing.
    – muru
    Aug 27, 2015 at 9:01
  • 1
    Excuse me for interjecting, but I don't think being able to quit makes any sense as an explanation. Any script can quit. Any normal autocmd can also quit. So what? What's wrong with that? What's right about not doing it? Rather, I don't see any use for a SourcePost. SourcePre could be useful for debugging. Overriding SourceCmd could be useful for things like fetching the script from a remote location, and then you'd also be able to add code afterwards. But adding code without overriding SourceCmd? I can't really think of any useful scenario. Aug 27, 2015 at 11:19

1 Answer 1


Old one, but this has been added as per patch 8.1.0729

Problem: There is a SourcePre autocommand event but not a SourcePost.
Solution: Add the SourcePost autocommand event. (closes #3739)


Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.