Gvim on windows: solving Tagbar’s “window flashing” problem using Vim-Shell

One of the annoying things about using Gvim on windows is that every time a plugin calls Vim’s system command, the DOS command window will flash. Tagbar is one of the many plugins which have this problem. Here is a solution for this in Tagbar using Xolox’s Vim-Shell plugin. Please note that I am not referring to Shougo’s plugin with the same name.

Simple Workaround

Before coming to the actual solution, here is a simple workaround. Vim-Shell allows you to use Vim in fullscreen mode, just press F11 to do this. When Vim is in fullscreen mode the flashing command window will not be visible. This workaround has the advantage that it works with other plugins, like Syntastic and Ale as well.

Solution

The second option is to edit tagbar.vim file of the Tagbar plugin and replace Vim’s system command with Vim-Shell’s xolox#misc#os#exec function. The exec function does not show the command window. Please note that, while this change has been working for me for a few months now, the possibility of it breaking something cannot be ruled out.

Here is what you need to do, inside autoload\tagbar.vim file there is a function named s:ExecuteCtags(). Inside this function replace the following line.

with these lines.

Here is the diff for the change

Diff for the change

Do not update Tagbar

After the modification, you will have to make sure that when updating Vim plugins you do not update Tagbar. If you are using Vim-Plug as a plugin manager, this can be easily done by replacing
Plug ‘majutsushi/tagbar’ with something like Plug ‘~/.vim/plugged/tagbar’ in your plugins list; that is you just specify the path to where Tagbar is installed.

Leave a Comment

Your email address will not be published. Required fields are marked *