ap / vim-buftabline

Forget Vim tabs – now you can have buffer tabs
http://www.vim.org/scripts/script.php?script_id=5057
MIT License
780 stars 75 forks source link

buftabline and goyo don't work together #64

Open AxelBohm opened 5 years ago

AxelBohm commented 5 years ago

Weird things keep appearing in the tab line when goyo is activated. See the following issue on the goyo repo: https://github.com/junegunn/goyo.vim/issues/171#issue-290189123

ap commented 5 years ago

Somehow this issue completely escaped my attention. Sorry about that. I’m looking into #67 right now.

ap commented 5 years ago

Well… this is quite a mess, really.

The problem is a Buftabline feature that’s necessary because Buftabline doesn’t support Vim tabs at all. What it does is Buftabline allows the standard Vim tab feature to take over when the user or another plugin has created a Vim tab. Otherwise you wouldn’t see what’s going on.

This collides with Goyo because Goyo works by creating a new Vim tab that it wants to hide. This is… not a use case I had foreseen. It makes complete sense given Goyo’s aim, of course, but it breaks my underlying assumption in Buftabline that the user needs to be able to see what’s going on when a Vim tab is created.

Not sure yet how I’m going to address this…

vigilancer commented 5 years ago

For history: I've made a PR few days ago (#67) that was addressing this issue. Unfortunately that patch works for me only and is not good enough to go mainstream. Moving conversation from PR to this issue.

How about (arguably dirty) check if exists('#goyo') before check for number of tabs?

vigilancer commented 5 years ago

like this: https://github.com/vigilancer/vim-buftabline/commit/2058d75bb55fd075830c3470a2bd8db1978df426

I didn't find in :h goyo any knobs that could affect showtabline so IMO it is safe to assume that when Goyo is enabled it wants to hide tabline.

Note that one still have to manually call buftabline#update on GoyoEnter and GoyoLeave events:

autocmd! User GoyoEnter nested call <SID>GoyoEnter()
autocmd! User GoyoLeave nested call <SID>GoyoLeave()

function! s:GoyoEnter() "
    :call buftabline#update(0)
endfunction "

function! s:GoyoLeave() "
    :call buftabline#update(0)
endfunction "
ap commented 5 years ago

Arguably dirty. 🙂

Right now I’m thinking of adding another setting in Buftabline to disable the Vim tabs fallback. In the future when Buftabline supports tab pages, the same setting could be expanded to allow the user to control whether tab pages should trigger Buftabline’s internal support, the fallback to Vim tabs, or nothing. And once this setting exists, Goyo could use it to override Buftabline’s handling of tabs while Goyo is active, much as it already does for several other plugins.

Logically I don’t see a problem with that, but I can’t yet say whether it feels right, so I wanna sleep on it for a bit. Adding a setting is a long-term commitment.