airblade / vim-gitgutter

A Vim plugin which shows git diff markers in the sign column and stages/previews/undoes hunks and partial hunks.
MIT License
8.37k stars 297 forks source link

Slow tab switching #82

Closed wmayner closed 10 years ago

wmayner commented 11 years ago

This plugin is awesome but causes Vim to switch tabs very slowly (~1 second).

I'm using the spf13 vim distribution. Let me know if there's any other info I can provide to determine the cause.


Vim version info:

IM - Vi IMproved 7.3 (2010 Aug 15, compiled Apr 9 2013 13:09:12) MacOS X (unix) version Included patches: 1-754 Compiled by will@terminus.home Huge version with MacVim 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() +fullscreen -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_sgr -mouse_sysmouse +mouse_urxvt +mouse_xterm +multi_byte +multi_lang -mzscheme +netbeans_intg +odbeditor +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 +transparency +user_commands +vertsplit +virtualedit +visual +visualextra +viminfo +vreplace +wildignore +wildmenu +windows +writebackup -X11 -xfontset +xim -xsmp -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: "/Applications/MacVim.app/Contents/Resources/vim" Compilation: clang -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_MACVIM -Wall -Wno-unknown-pragmas -pipe -DMACOS_X_UNIX -no-cpp-precomp -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -I/System/Library/Frameworks/Tcl.framework/Headers -D_REENTRANT=1 -D_THREAD_SAFE=1 -D_DARWIN_C_SOURCE=1 Linking: clang -L. -L. -L/usr/local/lib -o Vim -framework Cocoa -framework Carbon -lncurses -liconv -framework Cocoa -fstack-protector -L/usr/local/lib -L/System/Library/Perl/5.12/darwin-thread-multi-2level/CORE -lperl -lm -lutil -lc -framework Python -F/System/Library/Frameworks -framework Tcl -framework CoreFoundation -framework Ruby

tex commented 8 years ago

It printed that this is not git repository. Press enter...

airblade commented 8 years ago

@tex Sorry, I meant did it take a long time? How about :echo system('git ls-files --error-unmatch FILE') where FILE is the current file?

tex commented 8 years ago

Well, it is relative fast. The thing is that I had like 4 or more buffers in each tab. And apparently it sums up so it is visible.

benoittgt commented 7 years ago

Hello

It can very slow if you use autosave like me :

autocmd BufLeave,FocusLost * silent! wall

" or

au FocusLost * silent! wa
set autowrite

Even with

let g:gitgutter_realtime = 0
let g:gitgutter_eager = 0

Sadly I don't use gitgutter anymore for this :(

vrybas commented 7 years ago

It's faster on Neovim. At least feels faster, because it's asynchronous and doesn't block editing.

airblade commented 7 years ago

It's also asynchronous on Vim these days ;)

I use autocmd FocusLost * nested silent! wa and it doesn't slow down vim at all.

I suspect it's the BufLeave / autowrite which write the buffer you've just left causing gitgutter to process it again, on top of processing the buffer you're entering.

Perhaps gitgutter could be smarter about not re-running on buffer-write when there haven't been any changes since the last run – similar to how it doesn't re-run on CursorHold(I) when there haven't been any changes since the last run.