开发者

Why might Vim quit when the ‘:bdelete’ command is run?

开发者 https://www.devze.com 2023-02-28 14:02 出处:网络
According to the answer of this question, the :bd command should not quit Vim (gVim) when it is the last buffer remaining. Unfortunately, it does close gVim in my case. Did I understand something wron

According to the answer of this question, the :bd command should not quit Vim (gVim) when it is the last buffer remaining. Unfortunately, it does close gVim in my case. Did I understand something wrong about :bd?

I am also using a preconfigured vimrc file. Maybe a setting in there has that side affect, but I couldn’开发者_StackOverflowt find it.


Try doing the following:

:set eventignore=all | bd | set eventignore=

If this won't quit vim then you have some plugin that defines an autocommand that quits vim when no more buffers are present in the list, so after that try doing

verbose autocmd BufWinLeave,BufLeave,BufDelete,BufUnload,BufWipeout

This will show you all autocommands attached to given events (these are events that are executed when buffer is deleted) and where they were defined. Note that I do not have any autocommands attached to these events that are defined by plugins in standart vim distribution.

Update: I do not see anything bad in your output. You may also try

verbose autocmd BufNew,BufAdd,BufCreate,BufEnter,BufWinEnter

(because when you leave last buffer new empty one is created). If this does not show anything suspicious, start ignoring event types: if you are on 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 iterate until you find event name that causes trouble. After this you can use execute "verbose autocmd" $event in vim to narrow number of plugins that should be checked. After you got list of autocmd groups (augroup names are shown just before event name in your output: railsPluginDetect is one of such groups), delete events in them (augroup {GroupName} | execute 'autocmd!' | augroup END) and find out which plugin to claim.

Alternatively, you can use debugger:

debug bd

, then s<CR>n<CR><CR><CR>... until vim quits; don't forget to remember what vim have shown above > prompt before quiting.

0

精彩评论

暂无评论...
验证码 换一张
取 消