Ben Fritz wrote
> But, you might be able to hack a TabLeave/TabEnter autocmd to do things
> automatically
Following this suggestion I ended with the following code:
augroup FocusOnTabClose
au!
au TabLeave * call TabCloseLeave()
au TabEnter * call TabCloseEnter()
augroup END
function! TabCloseLeave()
" Vim default behavior is fine for the first and the last tab
if tabpagenr() != 1 && tabpagenr() != tabpagenr('$')
augroup TabCloseBufWinLeave
au!
autocmd BufWinLeave * let g:TabClosedFlag = 1
augroup END
endif
endfunction
function! TabCloseEnter()
if exists("#TabCloseBufWinLeave")
au! TabCloseBufWinLeave
endif
if exists('g:TabClosedFlag')
unlet! g:TabClosedFlag
tabprev
endif
endfunction
It is based on the observation that there is a BufWinLeave event between the
TabLeave and TabEnter events when tabpgage is closed.
--
View this message in context: http://vim.1045645.n5.nabble.com/Tab-Order-tp5708299p5722304.html
Sent from the Vim - General mailing list archive at Nabble.com.
--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment