New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Toggle Lightline when using Goyo #83

Closed
obxhdx opened this Issue Oct 16, 2014 · 4 comments

Comments

Projects
None yet
3 participants
@obxhdx

obxhdx commented Oct 16, 2014

I have Goyo.vim installed, which provides a distraction-free mode.

I want to temporarily disable Lightline when Goyo gets enabled, just like Goyo already does for some other plugins: https://github.com/junegunn/goyo.vim/blob/master/plugin/goyo.vim#L150.

I tried calling lightline#disable() but Lightline always comes back after a few seconds.

@itchyny

This comment has been minimized.

Owner

itchyny commented Oct 16, 2014

Goyo automatically disables lightline as you see at https://github.com/junegunn/goyo.vim/blob/master/plugin/goyo.vim#L177

@obxhdx

This comment has been minimized.

obxhdx commented Oct 17, 2014

Thanks for pointing out that line in Goyo. But like I said, after disabled, Lightline was reappearing after some time.

Anyways, I just found out what the problem really was... I had the following configuration:

autocmd CursorHold,BufWritePost,InsertLeave * call s:component_expand()
function! s:component_expand()
  call TrailingSpaceWarning()
  call MixedIndentSpaceWarning()
  call lightline#update()
endfunction

So, that CursorHold was the issue.

@itchyny

This comment has been minimized.

Owner

itchyny commented Oct 17, 2014

You call lightline#update so the statusline is updated. CursorHold is triggered even when you use Goyo or anything.

@yous

This comment has been minimized.

yous commented Mar 19, 2016

You can modify your autocmd to update lightline.vim only when it's enabled.

autocmd CursorHold,BufWritePost,InsertLeave * call s:component_expand()
function! s:component_expand()
  call TrailingSpaceWarning()
  call MixedIndentSpaceWarning()
  if exists('#lightline')
    call lightline#update()
  endif
endfunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment