Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get rid of this "Auto Commands" message from vim?

Tags:

vim

If I have this line in my vimrc

au VimLeave %bdelete

Then whenever vim starts it says

--- Auto-Commands ---
Press ENTER or type command to continue

I have that line there to empty the buffers from gvim, because new gvim instances have massive :ls output from previous runs. Notably, gvim doesn't actually produce this prompt.

Obviously I can set this instance up to only occur during gvim startup and not console vim, but I'd like to understand this rather than avoid it. Mostly I'm confused that VimLeave seems to cause things to happen on startup.

TIA Altreus

like image 564
Altreus Avatar asked Oct 15 '14 11:10

Altreus


1 Answers

The problem is that this is an incomplete :autocmd definition, so Vim attempts to list all VimLeave autocommands defined for the pattern %bdelete. You need to specify the any file pattern to make it work:

au VimLeave * %bdelete

Also, check whether you have % in your 'viminfo' option; that one enables the saving and restoring of the buffer list you're complaining about. The f option of file marks may also result in buffers being restored; you could try :set viminfo+=f0.

like image 72
Ingo Karkat Avatar answered Nov 03 '22 01:11

Ingo Karkat