Rgb sequence garbage printed when I open terminal in vim

136 Views Asked by At

I use tmux, alacrity and vim on OSX Catalina. Each time I open a terminal inside of vim, the terminal opens with this gibberish being printed:

4;0;rgb:28/28/284;1;rgb:fb/49/344;2;rgb:b8/bb/264;3;rgb:fa/bd/2f4;4;rgb:83/a5/984;5;rgb:d3/86/9b4;6;rgb:8e/c0/7c4;7;rgb:
d5/c4/a14;8;rgb:66/5c/544;9;rgb:fb/49/344;10;rgb:b8/bb/264;11;rgb:fa/bd/2f4;12;rgb:83/a5/984;13;rgb:d3/86/9b4;14;rgb:8e/
c0/7c4;15;rgb:fb/f1/c74;16;rgb:fe/80/194;17;rgb:d6/5d/0e4;18;rgb:3c/38/364;19;rgb:50/49/454;20;rgb:bd/ae/934;21;rgb:eb/d
b/b210;rgb:d5/c4/a111;rgb:28/28/2812;7%

It forces me to type clear each time I want to use the terminal inside vim, and that's annoying.

I have this in my tmux.conf:

set -g default-terminal "screen-256color"
set -ga terminal-overrides ",xterm-256color:Tc"

and this in my vimrc file:

if !has('gui_running') && &term =~ '^\%(screen\|tmux\)'
   let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
   let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
endif

colorscheme darcula

and this in my alacrity.yml:

shell:
  program: /bin/zsh
  args:
    - -l
    - -c
    - "tmux attach || tmux"
env:
  TERM: xterm-256color

The output of vim --version is:

VIM - Vi IMproved 9.0 (2022 Jun 28, compiled Sep 01 2022 15:00:53)
macOS version - x86_64
Included patches: 1-350
Compiled by Homebrew
Huge version without GUI.  Features included (+) or not (-):
+acl               +file_in_path      +mouse_urxvt       -tag_any_white
+arabic            +find_in_path      +mouse_xterm       -tcl
+autocmd           +float             +multi_byte        +termguicolors
+autochdir         +folding           +multi_lang        +terminal
-autoservername    -footer            -mzscheme          +terminfo
-balloon_eval      +fork()            +netbeans_intg     +termresponse
+balloon_eval_term +gettext           +num64             +textobjects
-browse            -hangul_input      +packages          +textprop
++builtin_terms    +iconv             +path_extra        +timers
+byte_offset       +insert_expand     +perl              +title
+channel           +ipv6              +persistent_undo   -toolbar
+cindent           +job               +popupwin          +user_commands
-clientserver      +jumplist          +postscript        +vartabs
+clipboard         +keymap            +printer           +vertsplit
+cmdline_compl     +lambda            +profile           +vim9script
+cmdline_hist      +langmap           -python            +viminfo
+cmdline_info      +libcall           +python3           +virtualedit
+comments          +linebreak         +quickfix          +visual
+conceal           +lispindent        +reltime           +visualextra
+cryptv            +listcmds          +rightleft         +vreplace
+cscope            +localmap          +ruby              +wildignore
+cursorbind        +lua               +scrollbind        +wildmenu
+cursorshape       +menu              +signs             +windows
+dialog_con        +mksession         +smartindent       +writebackup
+diff              +modify_fname      -sodium            -X11
+digraphs          +mouse             -sound             -xfontset
-dnd               -mouseshape        +spell             -xim
-ebcdic            +mouse_dec         +startuptime       -xpm
+emacs_tags        -mouse_gpm         +statusline        -xsmp
+eval              -mouse_jsbterm     -sun_workshop      -xterm_clipboard
+ex_extra          +mouse_netterm     +syntax            -xterm_save
+extra_search      +mouse_sgr         +tag_binary
-farsi             -mouse_sysmouse    -tag_old_static
   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/local/share/vim"
Compilation: clang -c -I. -Iproto -DHAVE_CONFIG_H -DMACOS_X -DMACOS_X_DARWIN -g -O2 -D_REENTRANT -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: clang -L. -fstack-protector-strong -L/usr/local/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/[email protected]/lib -L/usr/local/opt/readline/lib -L/usr/local/lib -o vim -lncurses -liconv -lintl -framework AppKit -L/usr/local/opt/lua/lib -llua5.4 -mmacosx-version-min=10.15 -fstack-protector-strong -L/usr/local/lib -L/usr/local/opt/perl/lib/perl5/5.34/darwin-thread-multi-2level/CORE -lperl -lm -lutil -lc -L/usr/local/opt/[email protected]/Frameworks/Python.framework/Versions/3.10/lib/python3.10/config-3.10-darwin -lpython3.10 -framework CoreFoundation -lruby.3.1 -L/usr/local/Cellar/ruby/3.1.2_1/lib

I've looked into number of solutions that I've found but none of them seemed to work.

0

There are 0 best solutions below