goyo.vim
goyo.vim copied to clipboard
Artifacts in Neovim
Maybe this should be regarded as more of a neovim issue, but Goyo seems not to conceal everything that it is intended to when run in neovim. I've attached a screenshot:
Possibly related to their addition of EndOfBuffer highlight group I guess. But I can't reproduce the problem maybe because I don't have the latest version of nvim. I'll look into it when I get some time.
Calling the following function helps, somewhat:
function! GoyoNeovim()
let s:guibg = synIDattr(synIDtrans(hlID("Normal")), "bg", "gui")
execute("hi NonText guifg=" . s:guibg)
execute("hi StatusLine guifg=" . s:guibg)
execute("hi StatusLineNC guifg=" . s:guibg)
endfunction
In a GUI for neovim (e.g. neovim.app), it solves the problem. In the terminal (with truecolor), it gets the tildes and other characters very close to the background, but doesn't achieve a perfect match.
Something which may be related to this issue is that it appears that in neovim, synIDattr
behaves as if it is in a terminal (even when called in an attached GUI), but neovim renders everything according to guifg
and guibg
when truecolor is on.
I'm using neovim with true color in urxvt and fixed this issue by adding this line to my goyo_enter function.
highlight NonText guifg=#181818 guibg=#181818
#181818 is my vim background color, I tried using bg or 0 and it didn't work. Try adding this line and setting it to the hex value of your background.
I also get artifacts. Sadly @dylanaraps fix didn't work for me. Here is two screenshots to compare, the first one is Vim 7.4.2247 with 256 colors enabled, the second is NeoVim 0.1.5 with true colors enabled. In both I'm using deep-space.vim but making the background transparent in my .vimrc
:
I'm on xfce4-terminal 0.6.90.
I've fixed all artifacts for a transparent background through:
function! s:goyo_enter()
" Remove artifacts for NeoVim on true colors transparent background.
" guifg is the terminal's background color.
hi! VertSplit gui=NONE guifg=#1b202a guibg=NONE
hi! StatusLine gui=NONE guifg=#1b202a guibg=NONE
hi! StatusLineNC gui=NONE guifg=#1b202a guibg=NONE
endfunction
If one wants to remove the tildes, one could do hi! EndOfBuffer gui=NONE guifg=#1b202a guibg=NONE
.
More info at https://github.com/neovim/neovim/issues/5408.
synIDattr behaves as if it is in a terminal (even when called in an attached GUI),
For reference, that was fixed in https://github.com/neovim/neovim/pull/4851.
I'm getting these artifacts on vim 7.4 patches 1-1952