junegunn / goyo.vim

:tulip: Distraction-free writing in Vim
MIT License
4.49k stars 115 forks source link

EndOfBuffer symbols (~) and StatusLine carots (^) appear on eink screen #282

Closed javierdepascual closed 7 months ago

javierdepascual commented 7 months ago

Hi there and thank you for your work on Goyo. Right now I'm at the final stages of my "DIY Freewrite" project: a single-purpose device for creative writing on an eink screen. I'm using a raspberry pi 3B+ connected to a Waveshare eink screen. The process involves custom drivers and launching a Virtual Terminal. From there I launch Vim and load Goyo.

Goyo appears perfectly on my HD display: no EndOfBuffer symbols, no statusline carots... however, it's not the case for the eink display:

IMG_5505

Again, the Virtual Terminal doesn't show those symbols (~ and ^), it's just on the eink screen.

:hi StatusLineNC ctermfg=white hides the carots (^) on my eink screen, but when trying ':hi EndOfBuffer ctermfg=white' the EndOfBuffer symbols stay present on my eink.

I'm a very new/non-technical Vim user so it would take an eternity to figure this out by myself. I hope I can find out a solution so then I can share the .vimrc file and the whole project for other people to use, as the eink products like the Freewrite are really unnecessarily expensive and I feel a lot of writers could benefit from this.

Thank you.

junegunn commented 7 months ago

Hi, what do you see when you open :Goyo and run :hi EndOfBuffer | hi NonText | hi StatusLineNC | hi Normal?

You should see something like this:

EndOfBuffer xxx links to NonText NonText xxx term=bold ctermfg=237 ctermbg=237 gui=bold guifg=#727272 StatusLineNC xxx term=reverse ctermfg=237 ctermbg=237 gui=reverse guifg=#616161 guibg=#DFDEBD Normal xxx ctermfg=252 ctermbg=237 guifg=#D9D9D9 guibg=#4B4B4B

You can see that the foreground color for NonText is identical to its background color, that's how Goyo hides the symbols.

javierdepascual commented 7 months ago

NonText term=bold ctermfg=0 gui=bold guifg=Blue

StatusLineNC term=reverse ctermfg=0 gui=reverse

Normal xxx cleared

When changing StatusLineNC to the parameters you pasted the ^ symbols dissapear. When pasting the parameters for NonText the EndOfBuffer symbols appear on my HD screen and remain on my eink.

I must say I tried a color scheme that "emulates" an eink display (thinking it might speed up the refresh rate on my eink) from here: https://github.com/clinstid/eink.vim/blob/master/colors/eink.vim

I think before using this theme Goyo worked perfectly on my display. I actually deleted it, went back to default and even uninstalled and reinstalled vim to see if the issue came from using this theme (because it did make the symbols appear on my HD display). Right now I'm not sure, maybe I misremembered, but I bring it up just in case it helps.

But yeah, just wondering if maybe there was some theme interference and switching back to default didn't change those parameters or changed something else. In any case, as I've said. Entering those same parameters in vim just hides the status line symbols, not the EOB one. Moreover, it doesn't stay that way, I gotta re-enter the command every time I open a file.

junegunn commented 7 months ago

Normal xxx cleared

Goyo doesn't work with minimal color schemes like default, you need a theme that defines Normal colors. Because if a theme doesn't define the foreground and background colors for Normal, Goyo can't do the trick of setting the same color for fg and bg to hide the elements. What is your :echo g:colors_name?

javierdepascual commented 7 months ago

I installed gruvbox yesterday thinking it might help with another issue (my LXterminal on Raspbian doesn't display italics or underlines for proper use of VimWiki), so I'm no longer using the default theme, I'm using gruvbox and that's what the :echo displays.

I've just tried matching Normal and NonText to the parameters you just showed me and I still get the EOB ~'s, both in my virtual terminal and my eink screen. I don't mind changing to whatever color scheme you suggest!

junegunn commented 7 months ago

I've just tried matching Normal and NonText to the parameters you just showed m

No, I didn't mean you should manually do it, :Goyo does it for you. As far as I can tell, gruvbox works great with Goyo.

javierdepascual commented 7 months ago

Well... unfortunately I'm still getting the symbols. I've removed the carots from the statusline but the EOB ~'s remain. On my Virtual Terminal they are very dark grey, on my eink, of course, they're black. It's really frustrating because the StatusLineNC command did work. I just can't find an equivalent to do the same with the EOBs. I've tried a bunch already. Would changing my shell/terminal help with rendering certain colors maybe? Thank you.

javierdepascual commented 7 months ago

By Virtual Terminal I mean: I'm using vim inside a tty/virtual console environment, I don't know if that's the origin of the issue. I also had to enter this in .vimrc for gruvbox to display properly:

set t_Co=256 set t_ZH="\e[3m" set t_ZR="\e[23m"

So maybe there's a limitation in the number of colors my vim can display and Goyo doesn't adapt to all cases. Thing is I did manage to hide StatusLineNC, so I'm not losing hope.

junegunn commented 7 months ago

Try this:

vim -Nu <(cat << "EOF"
set nocompatible hidden laststatus=2

if !filereadable('/tmp/plug.vim')
  silent !curl --insecure -fLo /tmp/plug.vim
    \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
endif

source /tmp/plug.vim
call plug#begin('/tmp/plugged')
Plug 'junegunn/goyo.vim'
Plug 'morhetz/gruvbox'
call plug#end()

set t_Co=256
set t_ZH="\e[3m"
set t_ZR="\e[23m"

autocmd VimEnter * PlugClean! | PlugUpdate --sync | colo gruvbox | Goyo
EOF
)

It looks like this on my machine. As you can see, Goyo is working as expected.

image
javierdepascual commented 7 months ago
Error detected while processing /home/javierdepascual/.vimrc:
line    4:
E682: Invalid search pattern or delimiter
line   23:
E492: Not an editor command: EOF
line   24:
E492: Not an editor command: )
Press ENTER or type command to continue

And what I get on my tty is dark EOB's on both my hd and my eink screen. On my GUI/Desktop environment everything is fine.

My features and vim version:


$ vim --version

VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Oct 01 2021 01:51:08)
Included patches: 1-2434
Extra patches: 8.2.3402, 8.2.3403, 8.2.3409, 8.2.3428
Modified by team+vim@tracker.debian.org
Compiled by team+vim@tracker.debian.org
Huge version without GUI. Features included (+) or not (-):
+acl -farsi +mouse_sgr +tag_binary
+arabic +file_in_path -mouse_sysmouse -tag_old_static
+autocmd +find_in_path +mouse_urxvt -tag_any_white
+autochdir +float +mouse_xterm -tcl
-autoservername +folding +multi_byte +termguicolors
-balloon_eval -footer +multi_lang +terminal
+balloon_eval_term +fork() -mzscheme +terminfo
-browse +gettext +netbeans_intg +termresponse
++builtin_terms -hangul_input +num64 +textobjects
+byte_offset +iconv +packages +textprop
+channel +insert_expand +path_extra +timers
+cindent +ipv6 -perl +title
-clientserver +job +persistent_undo -toolbar
-clipboard +jumplist +popupwin +user_commands
+cmdline_compl +keymap +postscript +vartabs
+cmdline_hist +lambda +printer +vertsplit
+cmdline_info +langmap +profile +virtualedit
+comments +libcall -python +visual
+conceal +linebreak -python3 +visualextra
+cryptv +lispindent +quickfix +viminfo
+cscope +listcmds +reltime +vreplace
+cursorbind +localmap +rightleft +wildignore
+cursorshape -lua -ruby +wildmenu
+dialog_con +menu +scrollbind +windows
+diff +mksession +signs +writebackup
+digraphs +modify_fname +smartindent -X11
-dnd +mouse -sound -xfontset
-ebcdic -mouseshape +spell -xim
+emacs_tags +mouse_dec +startuptime -xpm
+eval +mouse_gpm +statusline -xsmp
+ex_extra -mouse_jsbterm -sun_workshop -xterm_clipboard
+extra_search +mouse_netterm +syntax -xterm_save
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
2nd user vimrc file: "~/.vim/vimrc"
user exrc file: "$HOME/.exrc"
defaults file: "$VIMRUNTIME/defaults.vim"
fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -Wdate-time -g -O2 -ffile-prefix-map=/build/vim-Wj0ILV/vim-8.2.2434=. -fstack-protector-strong -Wformat -Werror=format-security -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -o vim -lm -ltinfo -lselinux -lacl -lattr -lgpm -ldl
junegunn commented 7 months ago

The code I showed you above is a shell command. Just run it on your shell. You're not supposed to copy & paste it into your .vimrc.

javierdepascual commented 7 months ago

It didn't work, but I tried reinstalling vim manually from git instead of apt-get and now it works. Finally, a clean writing environment on my eink. Thank you immensely for your help though @junegunn 🙏