views:

1030

answers:

3

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  A: 

The simplest way on Linux/OS X/using Cygwin to just do..

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

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

C:\gVim\gVim.exe --remote-tab-silent %*
dbr
+6  A: 

It depends on your operating system and shell. Using linux you can always set up an alias like:

alias gvim='gvim --remote-tab-silent'

in your .bashrc (if you use bash as your login shell).

On windows see the Vim wiki for solution: http://vim.wikia.com/wiki/Launch_files_in_new_tabs_under_Windows .

Zsolt Botykai
+1  A: 

I often find that I want to go to a specific place in a file. The only way I found to do this was:

gvim --remote-send '^[:tabnew +$lineno $filename ^M'

where ^[ is esc (typed ctrl-v esc) and ^M is enter (ctrl-v enter).

Hope this helps. If anyone understands how to use --remote-expr, give me a shout.

alsuren