Vim alto uso da CPU ao abrir arquivos JS

4

O Vim e especialmente o Gvim para de responder e utiliza 100% da CPU ao abrir grandes arquivos .js (mais de 1000 linhas). Pressionar Ctrl c interrompe o processo. Qualquer que seja o Vim que tente abrir o arquivo, ele exibe o conteúdo do arquivo - tudo dobrado em uma única dobra - e cada entrada de caractere no modo de inserção leva minutos para ser exibida na tela. Então eu tenho que reiniciar o Vim, para poder editar os arquivos.

Isso não ocorre toda vez, mesmo para os mesmos arquivos, mas ocorre de 3 a 5 vezes por dia.

Usando strace -p PID , vejo as seguintes mensagens repetindo continuamente

poll([{fd=7, events=POLLIN}, {fd=6, events=POLLIN}, {fd=3, events=POLLIN}, {fd=4, events=POLLIN}, {fd=8, events=POLLIN}], 5, 0) = 0 (Timeout)
read(7, 0x7fffc4477280, 16)             = -1 EAGAIN (Resource temporarily unavailable)
recvfrom(6, 0x21848f4, 4096, 0, 0, 0)   = -1 EAGAIN (Resource temporarily unavailable)
poll([{fd=7, events=POLLIN}, {fd=6, events=POLLIN}, {fd=3, events=POLLIN}, {fd=4, events=POLLIN}, {fd=8, events=POLLIN}], 5, 0) = 0 (Timeout)
read(7, 0x7fffc4477280, 16)             = -1 EAGAIN (Resource temporarily unavailable)
recvfrom(6, 0x21848f4, 4096, 0, 0, 0)   = -1 EAGAIN (Resource temporarily unavailable)
poll([{fd=7, events=POLLIN}, {fd=6, events=POLLIN}, {fd=3, events=POLLIN}, {fd=4, events=POLLIN}, {fd=8, events=POLLIN}], 5, 0) = 0 (Timeout)
read(7, 0x7fffc4477280, 16)             = -1 EAGAIN (Resource temporarily unavailable)
recvfrom(6, 0x21848f4, 4096, 0, 0, 0)   = -1 EAGAIN (Resource temporarily unavailable)
...

Eu tentei com vim --noplugin , mas o mesmo problema ocorre. Eu estou em um Ubuntu 12.04.1 x64 rodando auto compilado Vim. vim :version fornece as seguintes informações:

VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Aug 15 2012 17:16:57)
Included patches: 1-631
Huge version with GTK2 GUI.  Features included (+) or not (-):
+arabic +autocmd +balloon_eval +browse ++builtin_terms +byte_offset +cindent    +clientserver +clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments +conceal +cryptv +cscope +cursorbind
+cursorshape +dialog_con_gui +diff +digraphs +dnd -ebcdic +emacs_tags +eval +ex_extra +extra_search +farsi +file_in_path +find_in_path +float +folding -footer +fork() +gettext -hangul_input
+iconv +insert_expand +jumplist +keymap +langmap +libcall +linebreak +lispindent +listcmds +localmap -lua +menu +mksession +modify_fname +mouse +mouseshape +mouse_dec -mouse_gpm -mouse_jsbterm
+mouse_netterm -mouse_sysmouse +mouse_xterm +mouse_urxvt +multi_byte +multi_lang -mzscheme +netbeans_intg +path_extra -perl +persistent_undo +postscript +printer +profile +python -python3
+quickfix +reltime +rightleft +ruby +scrollbind +signs +smartindent -sniff +startuptime +statusline -sun_workshop +syntax +tag_binary +tag_old_static -tag_any_white -tcl +terminfo +termresponse
+textobjects +title +toolbar +user_commands +vertsplit +virtualedit +visual +visualextra +viminfo +vreplace +wildignore +wildmenu +windows +writebackup +X11 -xfontset +xim +xsmp_interact
+xterm_clipboard -xterm_save
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
      user exrc file: "$HOME/.exrc"
  system gvimrc file: "$VIM/gvimrc"
    user gvimrc file: "$HOME/.gvimrc"
    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  -pthread -I/usr/include/gtk-2.0 -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/pango-1.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I /usr/include/libpng12   -I/usr/local/include  -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc   -L.  -rdynamic -Wl,-export-dynamic  -L/usr/local/lib -Wl,--as-needed -o vim   -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo -lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0 -lglib-2.0   -lSM -lICE -lXpm -lXt -lX11 -lXdmcp -lSM -lICE -lm -ltinfo -lnsl   -ldl     -L/usr/lib/python2.7/config -lpython2.7 -lpthread -ldl -lutil -lm -Xlinker -export-dynamic -Wl,-O1 -Wl,-Bsymbolic-functions   -lruby-1.9.1 -lpthread -lrt -ldl -lcrypt -lm  -L/usr/lib

Há algo de errado com minha configuração? Qual pode ser o problema?

    
por hinoglu 08.09.2012 / 15:06

1 resposta

3

Tente remover plug-ins ou arquivos de sintaxe extras para editar arquivos JS. Um vimscript ou arquivo de sintaxe mal escrito (basicamente um monte de regexes) pode fazer com que o Vim consuma todos os ciclos da CPU em um piscar de olhos.

    
por 08.09.2012 / 15:49