Open yousong opened 4 months ago
I've added a couple more changes to this PR to address a couple other areas of concern. It should now handle vim-9 with the newer handling, but pre-vim-9 will still behave as the old method.
I've tested the following scenaios
In this scenario, open a single file in a single window. Then with Tagbar open and NERDTree open, hit the :q
from the main window.
Open a single file, split the window, then open Tagbar and NERDTree. Then hit :q
from the one of the split windows
Open multiple files in different buffers, but only a single window. Then open Tagbar and NERDTree. Then hit :q
from the main window.
Open multiple files in different buffers, but only a single window. Then open Tagbar and NERDTree. Next edit one of the files, but don't write it. Then hit :q
from the main window.
In this scenario, open a single file in a single window. Then with Tagbar open and NERDTree open, hit the :q
from the main window.
Open a single file, split the window, then open Tagbar and NERDTree. Then hit :q
from the one of the split windows
Open multiple files in different buffers, but only a single window. Then open Tagbar and NERDTree. Then hit :q
from the main window.
y
chosen, then vim quits, if n
chosen, then main window closes, tagbar window closes, and netrw window is left open with both files in buffer list. This looks like a behavioral bug.Open a single file. Then open Tagbar and NERDTree. Next edit the file, but don't write it. Then hit :q
from the main window.
y
chosen, file is written and vim quits. If n
is chosen, file is not written and vim quits. If c
(cancel) chosen, then main file window remains, tagbar window closes, netrw window closesThis is definitely better, however in the cases where VIM would normally prompt a warning about something (multiple buffers, unwritten changes, etc), we have a break in functionality where we no longer see the prompt and windows are closed leaving VIM in an odd state.
I think we can build on this though and see if we can address these remaining items, maybe even fix the undesired behavior on vim-8.x as well.
The idea is taken from README.md of MattLombana/dotfiles
Fixes https://github.com/preservim/tagbar/issues/851