Closed jordwalke closed 6 years ago
config:
set hidden
let g:tabSystem = 'wintabs'
let g:wintabs_autoclose=1
let g:wintabs_autoclose_vim=1
let g:wintabs_switchbuf='useopen,usetab'
let g:wintabs_ui_modified*
let g:wintabs_ui_active_higroup = 'TabLineSel'
let g:wintabs_autoclose=2
seems to work but let g:wintabs_autoclose=1
doesn't.
Should be fixed in the latest commit. This is a very edge case that I can't fix completely due to how confirm/hidden interact with each other. The new behavior is that you can close a modified buffer if it's currently shown in another window or vimtab, with no confirm dialog. I think this behavior is less broken than not closing with no error/confirm.
Let me know if this is fixed for you, and if it feels "more correct" than before.
I'll check it out: For posterity here's the workaround I created. You might find it useful to handle some edge cases - I basically just detect whether or not there are unsaved changes before even calling wintabs#close()
. The problem is that in this workaround, if you have the file open in another split, it resets the modifications to the files to the last saved version even in the other split. I think an improvement would be to first see if the file is open anywhere else before resetting, or before even asking if they want to save changes upon 'close'.
function MaybeCloseWinTab()
if &modified
let choice = confirm("File has unsaved changes!", "&Save\n&Cancel\n&Don't Save", 2)
if choice == 3
" Don't save: Reset the file then call WintabsClose
execute "silent earlier 1f"
call wintabs#close()
elseif choice == 2 || choice == 0
" Cancel
elseif choice == 1
execute ":w"
call wintabs#close()
endif
else
call wintabs#close()
endif
endfunction
Closing this as I implemented your suggestion.
:e newFile.txt
vsplit
:WintabsClose
.