Thursday, July 31, 2014

Re: Tab Order

On Wednesday, 30 July, 2014 at 20:20:38 BST, mMontu wrote:
>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.

For me, with the above in tab.vim:

vim -u NONE -p 1 2 3 " Places me in tab 1
:source tab.vim
3gt " Places me in tab 3
:q " Places me in tab 2

--
--
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: