mirror of
https://github.com/vim-airline/vim-airline.git
synced 2024-11-25 09:41:33 +08:00
tabline: Give error message, if switching buffers is not possible
When using Neovim and switching to another buffer with the mouse and the current buffer is modified, Vim refuses to switch buffers rightfully, if the user has not set 'hidden' or 'autowrite' (because it is going to unload the buffer from memory). So catch this case and let the user know. Note: :b! would be another possibility, but I do not prefer using this attribute, because it is not clear what happens to the current buffer. I think it is made hidden, but I prefer to be explicit here closes #2478
This commit is contained in:
parent
841a355196
commit
de73a21903
|
@ -220,7 +220,11 @@ function! airline#extensions#tabline#buffers#clickbuf(minwid, clicks, button, mo
|
|||
if a:clicks == 1 && a:modifiers !~# '[^ ]'
|
||||
if a:button is# 'l'
|
||||
" left button - switch to buffer
|
||||
silent execute 'buffer' a:minwid
|
||||
try
|
||||
silent execute 'buffer' a:minwid
|
||||
catch
|
||||
call airline#util#warning("Cannot switch buffer, current buffer is modified! See :h 'hidden'")
|
||||
endtry
|
||||
elseif a:button is# 'm'
|
||||
" middle button - delete buffer
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user