I'd been using Linux Mint MATE for years, and recently moved to Arch Linux with MATE Desktop Environment without any change of hardware or .vimrc. (By the way, I use no plugin.) After that, when I open a file on vim and

  • scroll up/down

  • or, minimize the window and un-minimize it later

  • or, use "show deskop" functionality and then unuse it

, the screen is sometimes be corrupted in a way that the same lines are apparently duplicated. This has never occurred on Linux Mint on the same machine, and Linux Mint on MacbookPro.

For example, the first picture is a healthy state without any corruption.

enter image description here

The opened file consists only of ASCII characters (with UTF-8 encodings) and short enough not to cause memory problems. This screen can sometimes be (corruptions are underlined):

enter image description here

enter image description here

Pressing Ctrl+L to redraw the display solves the problem, but it is really annoying.

What is bad is that I don't know when it occurs. So I cannot reproduce the problem to debug or find the cause.

What I tried is

  • uninstall Arch's original vim and compile vim from the official source, because I did so also on Linux Mint

  • do some gpu settings

  • unset TERM, COLORTERM or try many values of them according to scrolling is messed up and Vim NerdTree corrupts when using Tmux (NOTE: I do not use tmux or screen.)

  • change HDMI-cable to a quality one

  • change startup command bound to mate-terminal from the default bash to env TERM=xterm bash

  • unset cursorline

  • change terminal emulator from mate-terminal to gnome-terminal

  • :set term=builtin_term (see help builtin-terms)

  • :set nottybuiltin (this made the frequency of occurrence larger)

What I don't want to do is

  • change font

  • change desktop environment

Does anyone have an idea why that occurs? I really want to solve the problem.


I'll add any information if required.

~ $ neofetch
OS: Arch Linux x86_64
Kernel: Linux 5.3.5-arch1-1-ARCH
Shell: bash 5.0.11
Resolution: 1920x1080 @ 60.00Hz
Terminal: mate-terminal
CPU: Intel i5-7500 (4) @ 3.8GHz [39.0°C]
GPU: NVIDIA GeForce GTX 1050 Ti
Memory: 1405MiB / 15978MiB [=--------------]
CPU Usage: 2% [---------------]
Locale: en_US.UTF-8 

~ $ vi --version
VIM - Vi IMproved 8.1 (2018 May 18, compiled Oct  4 2019 02:04:19)
Included patches: 1-2109
Compiled by me
Huge version with GTK2 GUI.  Features included (+) or not (-):
+acl               -farsi             -mouse_sysmouse    -tag_any_white
+arabic            +file_in_path      +mouse_urxvt       -tcl
+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              +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              +wildmenu
+cursorbind        -lua               +scrollbind        +windows
+cursorshape       +menu              +signs             +writebackup
+dialog_con_gui    +mksession         +smartindent       +X11
+diff              +modify_fname      +sound             -xfontset
+digraphs          +mouse             +spell             +xim
+dnd               +mouseshape        +startuptime       +xpm
-ebcdic            +mouse_dec         +statusline        +xsmp_interact
+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 file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  system gvimrc file: "$VIM/gvimrc"
    user gvimrc file: "$HOME/.gvimrc"
2nd user gvimrc file: "~/.vim/gvimrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
    system menu file: "$VIMRUNTIME/menu.vim"
  fall-back for $VIM: "/usr/local/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK  -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.
0/include -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/lib/libffi
-3.2.1/include -I/usr/include/harfbuzz -I/usr/include/fribidi -I/usr/include/freetype2 -I/usr/include/li
bpng16 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libmoun
t -I/usr/include/blkid -I/usr/include/atk-1.0 -pthread    -g -O2 -D_REENTRANT  -U_FORTIFY_SOURCE -D_FORT
Linking: gcc   -L/usr/local/lib -Wl,--as-needed -o vim   -lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -l
atk-1.0 -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lharfbuz
z -lfontconfig -lfreetype  -lSM -lICE -lXpm -lXt -lX11 -lXdmcp -lSM -lICE  -lm -ltinfo -lelf -lnsl    -l
canberra  -lacl -lattr -lgpm -ldl           

By the way, I'm not experiencing the problem other than on vim (until today). less and any GUI applications like firefox work well.

  • 1
    Even if you don't want to do it, it would be pretty helpful to test another terminal emulator. This would allow you to know if the problem comes from your terminal or from Vim itself (which seems unlikely). Also if you use tmux, you could try to reproduce the problem without tmux, maybe it is the culprit. – statox Oct 9 at 21:08
  • 1
    @statox I think you are totally right. Now I try gnome-terminal which is the base of mate-terminal and still active. (mate-terminal is not abandoned but the last update was 2 years ago.) After the try, I'll append the result to the post. This may takes time because I cannot intentionally reproduce the problem. By the way, I've never used tmux or screen. Anyway, thank you for your advice. – ynn Oct 10 at 5:24
  • Do you have lazyredraw set? Maybe that's the cause. – lisowski.r Oct 10 at 14:16
  • 1
    This doesn't look like graphical glitch, but rather terminal glitch. It happens when multiple unsynchronised threads tried updating the terminal simultaneously. Try removing all your vim plugins and run basic vim with minimal config and put the plugins back one by one, there's likely multiple plugins that race each other when printing something to the screen, or probably you have a bg-ed (background) command running on the shell printing stuff while vim is running. – Lie Ryan Oct 18 at 3:40
  • 1
    I would rather test with a terminal that has full xterm compatibility, just like well, xterm – Christian Brabandt Oct 22 at 8:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.