Closed damnskippy closed 5 years ago
There's a tab local variable t:zoomed
that indicates whether it is currently zoomed (value 1) or not (value 0).
EDIT: Ideally you can show this in the status line, what would you expect such an API to do ?
Yes display it in the statusline. I believe t:zoomed is not loaded until zoom operation/toggle is invoked. So it will be an undefined variable to start with.
No different from tmux pane zoom and the tmux's zoom status flag. Thanks.
Thanks.
I have added a new API zoom#statusline()
, you can add it to your statusline with something like this :
set statusline+=%{zoom#statusline()}
It spits out the string 'zoomed' if we're zoomed currently and blank if not.
Yes, I pulled this in immediately - thanks again.
BTW, probably an edge case.
Open vim, single window (no splits), hit C-w
m
.
Vim will rightfully say "Already only one window".
zoom#statusline()
should probably not say zoomed in this case i.e s:is_zoomed()
probably shouldn't think we're zoomed() if there's only one window.
That would be a question for vim-zoom, whether we should invoke zoom or skip it in case there is just 1 window / split. The statusline is only displaying the zoom status so that's doing it's job correctly.
Indeed - question for vim-zoom.
I think it's a fair point that we should just not do anything in case we're already the only split in the current tab and vim-zoom is invoked, i'll make the changes appropriately.
Thank you.
Great plugin :+1:
When I add this to my .vimrc:
set statusline+=${zoom#statusline()}
I get a statusline that literally says "${zoom#statusline()}". I know this is an issue on my side but I'm wondering if anyone here might point me in the right direction.
@NeilsC sry there's a typo in the README, i'll fix it, it should be :
set statusline+=%{zoom#statusline()}
@dhruvasagar That did the trick, thanks!
Hi, is there a way to add it to vim-airline ?
@ovidius72 You'll need to refer to vim-airline help for that, :h airline-advanced-customizations
specifically may be what you need to use.
@ovidius72 ,
function! AirlineInit()
let g:airline_section_z = airline#section#create('%#__accent_bold#%{zoom#statusline()}%3l%#__restore__#/%L :%3v')
endfunction
autocmd User AirlineAfterInit call AirlineInit()
Is there a way to know whether one is currently zoomed in or not. If not it would be nice to add a flag or an API that could be queried to see the status. Often it's not unreasonable to zoom in on a window, switch out to some other task and then come back to vim a while later, and in such cases would be nice to remind/indicate the current zoom status. Would just need to expose the t:zoomed through an API. Thanks.