I have a vim 8.2 on a Gentoo Linux running on a more or less 8 years old PC.
I almost never have a performance issue with vim, unless you open a one-line huge xml oder json file, but those are vary rare cases.
My team has started using typescript and so many of our javascript files have
been transformed to ts. I use vim-plug
for plugging management and I added the
HerringtonDarkholme/yats.vim plugin.
However if I open a typescript file, even smaller ones, vim starts normally but
after a few seconds it gets very unresponsive, if I scroll down the syntax
highlight is also gone and eventually vim hangs. Looking at the process with
htop
I can see that the process is constantly running at 100% CPU. The only
thing I can do is a kill -9
.
Vim 8.2
(or at least the Gentoo version) has support for typescript in the
default installation, looking at the files in /usr/share/vim/vim82
the
provided files seems to be the same as the ones from the yats
plugin.
So to be sure that I don't have other plugins interfering, I made a backup of my vim config and remove it from my HOME directory.
The yats
github page says to explitly set set re=1
, so I created a new
~/.vimrc
file and added this line to it. When I open the typescript file, I
get the same result, so my other plugins didn't affect it at all.
So the set re=1
made me curious and if I set it instead to 2 or 0 (the
default), then opening the same typescript file does not lead vim to hang.
So, did I understand the warning on the github page correctly and I should add
set re=1
? If so, why is it worse for me?
How can you check what exactly in a plugin is making vim go crazy?
In case this is somehow important:
$ vim --version
VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Apr 4 2020 16:30:54)
Included patches: 1-360
Modified by Gentoo-8.2.0360
Compiled by shaoran@gallifrey
Huge version without GUI. Features included (+) or not (-):
+acl -farsi -mouse_sysmouse -tag_old_static
+arabic +file_in_path +mouse_urxvt -tag_any_white
+autocmd +find_in_path +mouse_xterm -tcl
+autochdir +float +multi_byte +termguicolors
-autoservername +folding +multi_lang -terminal
-balloon_eval -footer -mzscheme +terminfo
+balloon_eval_term +fork() +netbeans_intg +termresponse
-browse +gettext +num64 +textobjects
++builtin_terms -hangul_input +packages +textprop
+byte_offset +iconv +path_extra +timers
+channel +insert_expand -perl +title
+cindent +job +persistent_undo -toolbar
+clientserver +jumplist +popupwin +user_commands
+clipboard +keymap +postscript +vartabs
+cmdline_compl +lambda +printer +vertsplit
+cmdline_hist +langmap +profile +virtualedit
+cmdline_info +libcall -python +visual
+comments +linebreak +python3 +visualextra
+conceal +lispindent +quickfix +viminfo
+cryptv +listcmds +reltime +vreplace
-cscope +localmap +rightleft +wildignore
+cursorbind -lua +ruby +wildmenu
+cursorshape +menu +scrollbind +windows
+dialog_con +mksession +signs +writebackup
+diff +modify_fname +smartindent +X11
+digraphs +mouse -sound +xfontset
-dnd -mouseshape +spell -xim
-ebcdic +mouse_dec +startuptime -xpm
+emacs_tags +mouse_gpm +statusline +xsmp_interact
+eval -mouse_jsbterm -sun_workshop +xterm_clipboard
+ex_extra +mouse_netterm +syntax -xterm_save
+extra_search +mouse_sgr +tag_binary
system vimrc file: "/etc/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: x86_64-pc-linux-gnu-gcc -c -I. -Iproto -DHAVE_CONFIG_H -O2 -pipe -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: x86_64-pc-linux-gnu-gcc -L. -Wl,-O1 -fstack-protector -rdynamic -Wl,-export-dynamic -Wl,--no-undefined -Wl,-O1 -L/usr/local/lib -Wl,--as-needed -o vim -lSM -lICE -lXpm -lXt -lX11 -lXdmcp -lSM -lICE -lm -ltinfo -lelf -lnsl -lacl -lattr -lgpm -ldl -lpython3.6m -lpthread -ldl -lutil -lm -lruby24 -lpthread -lgmp -ldl -lcrypt -lm