Closed ches closed 9 years ago
Thanks for the report. It looks more like an issue of airline. All goyo does about airline is that it executes AirlineToggle
when entering the mode and AirlineToggle
and AirlineRefresh
on exit. I'm not a user of airline, so I don't think I'm going to further look into it.
Thanks for your response Junegunn. On first glance I thought that I agreed with you, but on further inspection I think this is actually Goyo's responsibility, because it creates a new tab before getting the values in goyo_revert
to restore later. Here is what happens:
showtabline
to 2 via a TabEnter
autocommand because there is now more than one tab.showtabline
into the goyo_revert
dictionary. So it's not storing the user's original setting, it's storing Airline's, which I would argue is why this is Goyo's error.AirlineToggle
, which causes Airline to restore showtabline
to the user's original value. At this point Airline has done the correct thing.showtabline
, overwriting the user's actual original showtabline
value which Airline had already restored when it was toggled off.Fundamentally, I think it would be wise if Goyo saved all of its setting values to restore before changing any Vim state, e.g. creating a new tab. For demonstration, this patch fixes the problem:
diff --git a/autoload/goyo.vim b/autoload/goyo.vim
index e4a904f..0e9b881 100644
--- a/autoload/goyo.vim
+++ b/autoload/goyo.vim
@@ -161,6 +161,8 @@ endfunction
function! s:goyo_on(width)
let s:orig_tab = tabpagenr()
+ let orig_showtabline = &showtabline
+
" New tab
tab split
@@ -172,7 +174,7 @@ function! s:goyo_on(width)
let t:goyo_pads = {}
let t:goyo_revert =
\ { 'laststatus': &laststatus,
- \ 'showtabline': &showtabline,
+ \ 'showtabline': orig_showtabline,
\ 'fillchars': &fillchars,
\ 'winminwidth': &winminwidth,
\ 'winwidth': &winwidth,
Okay, I see. Thanks for the investigation. I'll update the code and let you know.
Could update and test if it solves the problem?
Yep that resolves it, thanks for the quick response and the plugin!
:+1:
This is minor, and I'll see if I can find a workaround myself when I have a few minutes to grok the Goyo code, but just wanted to make note when I saw it.
I use the following settings for Airline:
Basically this means show a line for tabs at the top, only for real tabpages, and only when there is more than one. If I edit a single file in a Vim session and toggle Goyo on and off, the Airline tabline is left visible for only one tab.