goyo.vim icon indicating copy to clipboard operation
goyo.vim copied to clipboard

goyo broken with vim-airline-clock

Open Jemoka opened this issue 4 years ago • 3 comments

When using goyo and airline with enricobacis/vim-airline-clock, the originally hidden airline appears after the first update of the clock.

Screen Shot 2020-01-05 at 5 22 47 PM

Part of my .vimrc that matters:

noremap <Leader>g :Goyo<CR>
function! s:goyo_enter()
  Limelight
  let b:quitting = 0
  let b:quitting_bang = 0
  autocmd QuitPre <buffer> let b:quitting = 1
  cabbrev <buffer> q! let b:quitting_bang = 1 <bar> q!
endfunction
function! s:goyo_leave()
  Limelight!
  if b:quitting && len(filter(range(1, bufnr('$')), 'buflisted(v:val)')) == 1
    if b:quitting_bang
      qa!
    else
      qa
    endif
  endif
endfunction
autocmd! User GoyoEnter call <SID>goyo_enter()
autocmd! User GoyoLeave call <SID>goyo_leave()

Simplest solution (thus far) is to disable the airline clock or to disable/reenable the plugin at gogo_enter/gogo_leave. As the package is supporting airline hiding, this should be part of the default disabled packages as well. Using vim 8.1 with the latest versions of all packages mentioned.

Jemoka avatar Jan 06 '20 05:01 Jemoka

@Jemoka

Simplest solution (thus far) is to [...] disable/reenable the plugin at gogo_enter/gogo_leave

Did you get this to work? vim-airline-clock doesn't seem to have a toggle for enabling/disabling it at run-time, the closest setting I could find is let g:airline#extensions#clock#auto which I couldn't get working with GoyoEnter/GoyoLeave since it doesn't quite do what's needed here.

mawkler avatar Jul 07 '20 13:07 mawkler

@Melkster

@Jemoka

Simplest solution (thus far) is to [...] disable/reenable the plugin at gogo_enter/gogo_leave

Did you get this to work? vim-airline-clock doesn't seem to have a toggle for enabling/disabling it at run-time, the closest setting I could find is let g:airline#extensions#clock#auto which I couldn't get working with GoyoEnter/GoyoLeave since it doesn't quite do what's needed here.

Well... No. Unfortunately I just disabled the plugin entirely and used tmux('s clock). However, I have seen success of other folks somehow disabling the segment representing the clock in vim-airline.

Jemoka avatar Jul 07 '20 13:07 Jemoka

I think I have a solution. The problem is the timer in vim-airline-clock:

image

Calling timer_pause pauses or un-pauses the timer, so this is a quick vimrc fix:

autocmd! User GoyoEnter call s:on_goyo_enter()
autocmd! User GoyoLeave call s:on_goyo_exit()

function s:on_goyo_enter()
  if exists('g:airline#extensions#clock#timer')
    call timer_pause(g:airline#extensions#clock#timer, 1)
  endif
endfunction

function s:on_goyo_exit()
  if exists('g:airline#extensions#clock#timer')
    call timer_pause(g:airline#extensions#clock#timer, 0)
  endif
endfunction

I'll submit a patch to enricobacis/vim-airline-clock as I think the timer should be paused whenever Airline is toggled.

ferdv avatar Apr 10 '21 22:04 ferdv