vimsingle-instance

Let gVim always run a single instance


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)


Solution

  • 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.