Let gVim always run a single instance

Viewed 15750

Is there a way to let gVim only run a single instance, so that when a new file is opened with it it's automatically opened in a new tab in the currently running instance?

I know you can do that by passing --remote-tab-silent but I want to configure gvim so that this becomes the default behavior. i.e. I want to type gvim filename and make it act as if I passed the --remote-tab-silent option to it.

gVim 7.2

Edit

I'm on windows (vista)

13 Answers

If you are using the bash shell (on Linux/OS X/using Cygwin) is to add you ~/.bashrc file:

gvim () { command gvim --remote-silent "$@" || command gvim "$@"; }

On Windows I think you could have a gvim.bat batch-script to achieve the same..

gvim.exe -p --remote-tab-silent %1 %*

If gvim.exe isn't in your path

Run > Search "Environment"

Edit PATH var for current user or system.

Change your path in registry

HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Applications\gvim.exe\shell\edit\command

"Path2gvim\gvim.exe" "%1" -->
"Path2gvim\gvim.exe" --remote-tab-silent "%1"

Related