Skip to content
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

Window colour affected when returning from distraction free mode #160

Open
ashishtibrewal opened this issue Jul 31, 2017 · 14 comments · May be fixed by #195
Open

Window colour affected when returning from distraction free mode #160

ashishtibrewal opened this issue Jul 31, 2017 · 14 comments · May be fixed by #195

Comments

@ashishtibrewal
Copy link

When I run :Goyo! to return from distraction free mode, the colour of the window changes to grey (see images below). I'm not sure why it does that, do you think this could be caused due to some other plugin that I'm using or is it something to do with my custom configurations (i.e. ~/.vimrc) or is it entirely something else that's causing the problem? Any help/suggestions would be much appreciated, thank you. :)

Before running :Goyo
pregoyo

After running :Goyo
ingoyo

After running :Goyo!
postgoyo

@ultimatecoder
Copy link

Sharing your .vimrc file will help to reproduce this problem. Thanks!

@ashishtibrewal
Copy link
Author

They are available here and here.

@junegunn
Copy link
Owner

junegunn commented Aug 1, 2017

What is the value of :echo g:colors_name, and what happens when you do :execute 'colo' g:colors_name?

Anyway, there's no easy way to find the culprit. I would suggest that you comment out all your plugins and settings except Goyo, and see if the problem is still reproducible. If it's not, you can incrementally uncomment the other settings until you run into the problem.

@KmBKeef
Copy link

KmBKeef commented Aug 6, 2017

Same issue here
Executing the first command echo ...: vim tells me there is no such variable
after executing the execute 'colo' etc, colors change.

after executing the second one i ran the first command again
the result was default

@junegunn
Copy link
Owner

junegunn commented Aug 6, 2017

@KmBKeef I don't think Goyo works well with 16-color color schemes. Try with 256-color or true-color color schemes.

@rcrx
Copy link

rcrx commented Nov 5, 2017

I had a similar problem where my statusline formatting would be stripped upon exiting Goyo. I'll illustrate here how I fixed it, but I'll preface this by saying that I've only been using Linux for less than 6 months, Vim for less than 2 weeks, and I have 0 experience with programming (or anything of the sort)...so, this is probably not the best way to go about it. Nevertheless it's what I managed to come up with and it seems to work all right.

I had these lines in my vimrc:

hi StatusLine                  ctermfg=8     ctermbg=2     cterm=NONE     guifg=black     guibg=#005F87
set statusline=%<%F		
set statusline+=%M			
set statusline+=%y			
set statusline+=\ Buf:%n          
set statusline+=%=			
set statusline+=\ %{WordCount()}\ words,
set statusline+=\ %l/%L\ %P	

After deactivating Goyo the color would revert to the colorscheme's style. This is what I added to vimrc to rectify the matter:

function! Resetstatusline()  
        setlocal statusline=%<%F%M%y\ Buf:%n=%=\ %{WordCount()}\ words,\ %l/%L\ %P | :hi  StatusLine ctermfg=8 ctermbg=2 cterm=NONE guifg=black guibg=#005F87  
    endfunction

:map <LEADER>G :set go-=m \| :set go-=r \| :Goyo \| :Limelight<cr>
:map <LEADER><LEADER>G :Goyo \| :Limelight! \| :set go+=m \| :set go+=r \| :call Resetstatusline()<cr>

Could ashishtibrewal not do something similar, like map :Goyo! to run Goyo \| :colorscheme X?

@wgv-sethlivingston
Copy link

When I run :Goyo, it switches my colorscheme to default. Has anyone been able to determine the cause yet?

@andreyorst
Copy link

Not quite the same behaviour, but I've noticed that some elements change their colors.
Before running Goyo:
image
:Goyo:
image
:q:
image

@imyxh
Copy link

imyxh commented Jul 1, 2018

I also do some theming in my vimrc. Couldn't this be prevented with a so $MYVIMRC in the Goyo! command? Don't know if that would have any unintended consequences.

@nathanshelly
Copy link

Experiencing the same issue. Using neovim with onedark (256 colors) color scheme. None of the suggested status checks revealed anything weird.

Added the following line as a workaround (ref)
autocmd! User GoyoLeave source $HOME/.vimrc

Would love to see #195 that seems to address this issue merged! (provided people who know more about vimscript than I do think it's a good idea)

@cherti
Copy link

cherti commented May 6, 2019

I have a similar issue that might be related:
I use bg=light on neovim and when activating via :Goyo and deactivating again (via :Goyo or :Goyo!, doesn't matter) vim reproducably flipps to bg=dark. Maybe this is also the case for the above observed issues?

@rcrx
Copy link

rcrx commented May 23, 2019

@nathanshelly

Added the following line as a workaround (ref)
autocmd! User GoyoLeave source $HOME/.vimrc

Tried essentially the same thing but get a long string of errors (E174) related to keymappings. So I'm using this for now:

autocmd! User GoyoLeave silent! source $HOME/.vimrc

@holychowders
Copy link

I had this issue. My fix (and I think it would be wiped out if I updated the plugin) was to:

  1. Navigate to ~/.vim/vim_plug/goyo.vim/autoload/goyo.vim
  2. Delete line 340, execute 'colo '. get(g:, 'colors_name', 'default')

Screenshot from 2021-11-21 01-40-12

I'm guessing that in order for this to be a permanent fix, you guys could just push the deletion of that line into your repo. But, of course, I have no idea what side effects that may cause. I also don't know if this is the right way to solve the problem.

There you go. Hope it was helpful.

@tkapias
Copy link

tkapias commented Aug 30, 2022

I use "vim-nightfly-guicolors", and colo or sourcing did not work.

I confirm that only deleting the execute 'colo '. get(g:, 'colors_name', 'default'), line 340, worked.

It would be nice to delete it upstream or add some check if this is useful for something.

Edit: For those who will come across this issue, I invite you to go and see the PR 195 attached on the side. The solution is more advanced but has not yet been officially validated. In any case it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.