QuitPre
QuitPre is an autocommand event in Vim and Neovim that fires immediately before a quitting operation is executed. It is part of the editor’s autocommand framework, which lets scripts respond to a wide range of editor events. QuitPre sits alongside other exit-related events such as QuitPost and VimLeavePre, and is documented in the editor’s help system (for example, via :help QuitPre).
The primary purpose of QuitPre is to allow plugins and user scripts to perform finalization tasks before
Usage examples are straightforward lines of autocommand definitions, such as:
autocmd QuitPre * call MyCleanup()
Because QuitPre runs before the quit process, it can be used to prepare for shutdown or to
Compatibility and scope notes: QuitPre is supported in both Vim and Neovim, with broad adoption across plugins.