joshdick / onedark.vim

A dark Vim/Neovim color scheme inspired by Atom's One Dark syntax theme.
MIT License
3.9k stars 530 forks source link

statusline shows random characters on startup #173

Closed vstollen closed 5 years ago

vstollen commented 5 years ago

Terminal Emulator Info

Terminal emulator(s) and their version(s) used, if applicable: gnome-terminal 3.32.2-1, GNU bash, Version 5.0.7(1)-release

Output From vim --version

VIM - Vi IMproved 8.1 (2018 May 18 kompiliert am Jul  4 2019 23:02:48)
Inklusive der Patches: 1-1635
Übersetzt von Arch Linux
Riesige Version ohne GUI. Ein- (+) oder ausschließlich (-) der Eigenschaften:
+acl               -farsi             -mouse_sysmouse    -tag_any_white
+arabic            +file_in_path      +mouse_urxvt       +tcl/dyn
+autocmd           +find_in_path      +mouse_xterm       +termguicolors
+autochdir         +float             +multi_byte        +terminal
-autoservername    +folding           +multi_lang        +terminfo
-balloon_eval      -footer            -mzscheme          +termresponse
+balloon_eval_term +fork()            +netbeans_intg     +textobjects
-browse            +gettext           +num64             +textprop
++builtin_terms    -hangul_input      +packages          +timers
+byte_offset       +iconv             +path_extra        +title
+channel           +insert_expand     +perl/dyn          -toolbar
+cindent           +job               +persistent_undo   +user_commands
-clientserver      +jumplist          +postscript        +vartabs
-clipboard         +keymap            +printer           +vertsplit
+cmdline_compl     +lambda            +profile           +virtualedit
+cmdline_hist      +langmap           +python/dyn        +visual
+cmdline_info      +libcall           +python3/dyn       +visualextra
+comments          +linebreak         +quickfix          +viminfo
+conceal           +lispindent        +reltime           +vreplace
+cryptv            +listcmds          +rightleft         +wildignore
+cscope            +localmap          +ruby/dyn          +wildmenu
+cursorbind        +lua/dyn           +scrollbind        +windows
+cursorshape       +menu              +signs             +writebackup
+dialog_con        +mksession         +smartindent       -X11
+diff              +modify_fname      -sound             -xfontset
+digraphs          +mouse             +spell             -xim
-dnd               -mouseshape        +startuptime       -xpm
-ebcdic            +mouse_dec         +statusline        -xsmp
+emacs_tags        +mouse_gpm         -sun_workshop      -xterm_clipboard
+eval              -mouse_jsbterm     +syntax            -xterm_save
+ex_extra          +mouse_netterm     +tag_binary        
+extra_search      +mouse_sgr         -tag_old_static    
          System-vimrc-Datei: "/etc/vimrc"
        Benutzer-vimrc-Datei: "$HOME/.vimrc"
 zweite Benutzer-vimrc-Datei: "~/.vim/vimrc"
         Benutzer-exrc-Datei: "$HOME/.exrc"
      defaults Datei: "$VIMRUNTIME/defaults.vim"
     Voreinstellung für $VIM: "/usr/share/vim"
Übersetzt: gcc -c -I. -Iproto -DHAVE_CONFIG_H   -D_FORTIFY_SOURCE=2  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1       
Linken: gcc   -L. -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,-E -Wl,-rpath,/usr/lib/perl5/5.30/core_perl/CORE  -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -L/usr/local/lib -Wl,--as-needed -o vim        -lm -ltinfo -lelf -lnsl    -lacl -lattr -lgpm -ldl   -Wl,-E -Wl,-rpath,/usr/lib/perl5/5.30/core_perl/CORE -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -fstack-protector-strong -L/usr/local/lib  -L/usr/lib/perl5/5.30/core_perl/CORE -lperl -lpthread -ldl -lm -lcrypt -lutil -lc   -L/usr/lib -ltclstub8.6 -ldl -lz -lpthread -lm

Issue Description

Vim shows some random characters in the statusline, looking like some non rendered color codes:

^[[2;2R^[[>65;5603;1c^[]10;rgb:dcdc/e9e9/ebeb^G^[]11;rgb:4545/4646/4949^G

Putting colorscheme onedark above syntax on (unlike described in the README.md), solved this for me.

Steps to reproduce

Type vim into the Terminal.

vstollen commented 5 years ago

I just tested this on another machine and couldn't reproduce the issue there.

It's output of vim --version:

VIM - Vi IMproved 8.1 (2018 May 18, compiled Feb 22 2019 12:55:04)
Included patches: 1-875, 878, 884, 948

Using GNU bash, version 5.0.3(1)-release with the same terminal (gnome-terminal 3.32.2-1).

joshdick commented 5 years ago

Are you using the same terminal emulator on both machines?

vstollen commented 5 years ago

To clarify, my "second machine" was a server I connected to via ssh, so yes, I'm using the exact same emulator.

vstollen commented 5 years ago

I just installed another terminal emulator (deepin 3.2.7-1) and the issue still exists, so it doesn't seem to be an issue of the gnome-terminal.

joshdick commented 5 years ago

Can you paste the output of env (make sure it doesn't contain any sensitive data)?

vstollen commented 5 years ago

Here it is:

SHELL=/bin/bash
SESSION_MANAGER=local/vincent-laptop:@/tmp/.ICE-unix/1024,unix/vincent-laptop:/tmp/.ICE-unix/1024
COLORTERM=truecolor
XDG_MENU_PREFIX=gnome-
LC_ADDRESS=de_DE.UTF-8
LC_NAME=de_DE.UTF-8
SSH_AUTH_SOCK=/run/user/1000/keyring/ssh
DESKTOP_SESSION=gnome
LC_MONETARY=de_DE.UTF-8
EDITOR=/usr/bin/nano
XDG_SEAT=seat0
PWD=/home/vstollen/.vim
LOGNAME=vstollen
XDG_SESSION_DESKTOP=gnome
QT_QPA_PLATFORMTHEME=qt5ct
XDG_SESSION_TYPE=x11
XAUTHORITY=/run/user/1000/gdm/Xauthority
GJS_DEBUG_TOPICS=JS ERROR;JS LOG
WINDOWPATH=2
GDM_LANG=de_DE.UTF-8
HOME=/home/vstollen
USERNAME=vstollen
LC_PAPER=de_DE.UTF-8
LANG=de_DE.UTF-8
LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.pdf=00;32:*.ps=00;32:*.txt=00;32:*.patch=00;32:*.diff=00;32:*.log=00;32:*.tex=00;32:*.doc=00;32:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.axa=00;36:*.oga=00;36:*.spx=00;36:*.xspf=00;36:
XDG_CURRENT_DESKTOP=GNOME
VTE_VERSION=5603
GNOME_TERMINAL_SCREEN=/org/gnome/Terminal/screen/81b7e19e_2dba_4bad_ba22_bff5d94d7da4
YAOURT_COLORS=nb=1:pkg=1:ver=1;32:lver=1;45:installed=1;42:grp=1;34:od=1;41;5:votes=1;44:dsc=0:other=1;35
GJS_DEBUG_OUTPUT=stderr
XDG_SESSION_CLASS=user
TERM=xterm-256color
LC_IDENTIFICATION=de_DE.UTF-8
USER=vstollen
GNOME_TERMINAL_SERVICE=:1.63
DISPLAY=:1
SHLVL=1
LC_TELEPHONE=de_DE.UTF-8
LC_MEASUREMENT=de_DE.UTF-8
XDG_VTNR=2
XDG_SESSION_ID=2
XDG_RUNTIME_DIR=/run/user/1000
LC_TIME=de_DE.UTF-8
XDG_DATA_DIRS=/home/vstollen/.local/share/flatpak/exports/share/:/var/lib/flatpak/exports/share/:/usr/local/share/:/usr/share/
PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl
GDMSESSION=gnome
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
MAIL=/var/spool/mail/vstollen
LC_NUMERIC=de_DE.UTF-8
OLDPWD=/home/vstollen
_=/usr/bin/env
joshdick commented 5 years ago

Thanks! Can you post the same output but from the working machine? I wonder if there's something odd going on due to the de_DE.UTF-8 settings.

vstollen commented 5 years ago

Sure:

SHELL=/bin/bash
PWD=/export/files/disc04/users1/vst
LOGNAME=vst
XDG_SESSION_TYPE=tty
HOME=/export/files/disc04/users1/vst
SSH_CONNECTION=xx.xxx.xx.xxx xxxxx xxx.xx.xxx.xxx xx
XDG_SESSION_CLASS=user
TERM=xterm-256color
USER=vst
SHLVL=1
XDG_SESSION_ID=19004
XDG_RUNTIME_DIR=/run/user/9040
SSH_CLIENT=xx.xxx.xx.xxx xxxxx xx
PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/export/files/disc04/users1/vst/bin
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/9040/bus
MAIL=/var/mail/vst
SSH_TTY=/dev/pts/0
_=/usr/bin/env
joshdick commented 5 years ago

OK, thanks! The working machine has no LC_ variables.

On the problem machine, can you run this in the shell before running vim?

while read var; do unset $var; done < <(env | grep LC_ | sed 's/=.*//g')
vstollen commented 5 years ago

So I just tried that and the characters still show up.

joshdick commented 5 years ago

Can you repeat the above, but also run Vim with LANG=en_US.UTF-8 GDM_LANG=en_US.UTF-8 vim?

Apologies for missing those variables in my last response.

vstollen commented 5 years ago

When I run this in my terminal:

while read var; do unset $var; done < <(env | grep LC_ | sed 's/=.*//g')

Directly followed by this:

LANG=en_US.UTF-8 GDM_LANG=en_US.UTF-8 vim

The characters still show up.

vstollen commented 5 years ago

So I continued my testing and found out what these characters seem to be. The String consists of these 4 variables/terminal responses:

  1. t_u7 = ^[[2;2R
  2. t_RV = ^[[>65;5603;1c
  3. t_RF = ^[]10;rgb:dcdc/e9e9/ebeb^G
  4. t_RB = ^[]11;rbg:4545/4646/4949^G

So putting this on top of my vimrc fixes the problem:

set t_u7=
set t_RV=
set t_RF=
set t_RB=

But in my testing commenting out this line from colors/onedark.vim also seems to fix the issue:

set background=dark
joshdick commented 5 years ago

Interesting, good find!

I wonder what happens if you do either or both of the following, without making the .vimrc changes you mentioned:

# Based on < https://apple.stackexchange.com/questions/249307/tic-doesnt-read-from-stdin-and-segfaults-when-adding-terminfo-to-support-italic#comment309243_249307 >
mkdir -p ~/.terminfo
export TERMINFO=~/.terminfo
curl https://invisible-island.net/datafiles/current/terminfo.src.gz | gunzip > "$TERMINFO/terminfo.src"
tic -x -e xterm-256color "$TERMINFO/terminfo.src"
vstollen commented 5 years ago

unset TERM

unset TERM seems to help a little bit, but doesn't fix it completely.

Now the chars only show up on some files and only the first part t_u7 shows up. It also removes colors and syntax I tried opening various files and could not find any pattern, but if it shows up on a file it seems to always show up when opening that particular file.

On my vimrc file it didn't show up anymore for example.

local terminfo database

Generating a local terminfo database didn't seem to have any effect, neither with TERM set or unset.

While playing around I also found out, that removing these two lines from my vimrc also fixes the issue.

au VimEnter * silent! !xmodmap -e 'clear Lock' -e 'keycode 0x42 = Escape'
au VimLeave * silent! !xmodmap -e 'clear Lock' -e 'keycode 0x42 = Caps_Lock'
joshdick commented 5 years ago

I should have asked to see your .vimrc sooner. 🙂

It does look like those mappings you removed were the root cause of that issue, since other people also appear to have run into it:

https://unix.stackexchange.com/questions/510895/vim-statusline-shows-22r413300c10rgbe5e5-e5e5-e5e5g11rgb000 https://vi.stackexchange.com/questions/19865/what-is-this-gibberish-text-showing-in-my-command-line-and-how-do-i-remove-it

Since you found a fix for this issue, I'm going to close it, but feel free to keep the conversation going either way.