Vim crashes after deleting buffer (bd)

According to the answer to this question :bd should not exit Vim (GVim) when it is the last buffer. Unfortunately, it closes GVim in my case. I got something wrong with bd?

I also use the pre-configured vimrc file. Maybe there’s a side effect in the setup, but I couldn’t find it.

+7
source share
1 answer

Try the following:

 :set eventignore=all | bd | set eventignore= 

If this does not exit vim, then you have a plugin that determines the auto command that exits vim when there are no more buffers in the list, so after that try

 verbose autocmd BufWinLeave,BufLeave,BufDelete,BufUnload,BufWipeout 

This will show you all the autocommands attached to these events (these are the events that are executed when the buffer is deleted) and where they were defined. Please note that I do not have any auto commands associated with these events, which are determined by the plugins in the standard vim distribution.

Update: I see nothing wrong with your release. You can also try

 verbose autocmd BufNew,BufAdd,BufCreate,BufEnter,BufWinEnter 

(because when you leave the last buffer, a new empty one is created). If this does not show anything suspicious, start ignoring event types: if you are using linux, try the following script:

 for event in BufWinLeave BufLeave BufDelete BufUnload BufWipeout BufNew BufAdd BufCreate BufEnter BufWinEnter do event=$event vim file -c "set eventignore=$event | bd" done 

This script should start until you find the name of the event causing the problem. After that, you can use execute "verbose autocmd" $event in vim to limit the number of plug-ins you need to check. After you get the list of autocmd groups (the augroup names appear immediately before the event name in your output: railsPluginDetect is one of these groups), delete the events in them ( augroup {GroupName} | execute 'autocmd!' | augroup END ) and find out which plugin will require.

Alternatively, you can use the debugger:

 debug bd 

then s<CR>n<CR><CR><CR>... until vim exits; Remember to remember what vim showed above > before exiting.

+15
source

All Articles