How to run gVim in a single instance

desktopgnomevim

I want it in such a way that on double clicking an already opened file, or a new file, gVim uses the same window. From this question asked previously on Stackoverflow I figured out how to do this by putting up an alias like:

alias gvim="gvim --remote-tab-silent" || gvim

This works great for the terminal without any problems. To enable this for the desktop too, I tried editing the /usr/share/applications/gvim.desktop. The default execution command in gvim.desktop is:

gvim -f %F

I changed this to:

gvim --remote-tab-silent %F

This gives me trouble when I'm trying to open an already opened file. It takes too long to open and doesn't open in the end. What may have caused the problem? I'm running Gnome 2.x and Vim 7.2.x if it matters.

Best Answer

Changing StartupNotify from true to false in /usr/share/applications/gvim.desktop solves the problem.

Source: http://www.phacks.net/open-multiple-text-files-as-tabs-gvim-kde4/

Related Question