Vim Tips Wiki
Register
(Assign tip id + convert to TipNew template + minor clean)
(Add aliases)
Line 13: Line 13:
 
Here is how to open files in new tabs, instead of new instances of gvim, under Unix. It works even when you mouse click to open files in a file manager.
 
Here is how to open files in new tabs, instead of new instances of gvim, under Unix. It works even when you mouse click to open files in a file manager.
   
  +
== Desktop entry ==
 
In the <tt>gvim.desktop</tt> desktop file (<tt>/usr/share/applications/</tt> for most GNU/Linux systems) look for the "Exec" line. It will probably be like this:
 
In the <tt>gvim.desktop</tt> desktop file (<tt>/usr/share/applications/</tt> for most GNU/Linux systems) look for the "Exec" line. It will probably be like this:
 
<pre>Exec=gvim -f %F</pre>
 
<pre>Exec=gvim -f %F</pre>
 
Be aware that the desktop file is changed when you install a new version of gvim, so you may need to repeat the following change after an update.
 
   
 
Change the Exec line to:
 
Change the Exec line to:
Line 23: Line 22:
 
And in your [[vimrc]] add:
 
And in your [[vimrc]] add:
 
<pre>tab all</pre>
 
<pre>tab all</pre>
  +
 
'''Note:''' Be aware that the desktop file is changed when you install a new version of gvim, so you may need to repeat the following change after an update.
  +
  +
== alias ==
  +
You can ofcourse also use an <tt>alias</tt>:
  +
<pre>% alias gvim 'gvim -p --remote-tab-silent'</pre>
  +
  +
Most GUI programs don't read aliases, but it is useful if you start gvim from the shell.
   
 
==See also==
 
==See also==

Revision as of 11:55, 18 May 2008

Tip 1552 Printable Monobook Previous Next

created April 15, 2008 · complexity basic · author MagnusBerg · version 7.0


Here is how to open files in new tabs, instead of new instances of gvim, under Unix. It works even when you mouse click to open files in a file manager.

Desktop entry

In the gvim.desktop desktop file (/usr/share/applications/ for most GNU/Linux systems) look for the "Exec" line. It will probably be like this:

Exec=gvim -f %F

Change the Exec line to:

Exec=gvim -p --remote-tab-silent %F

And in your vimrc add:

tab all

Note: Be aware that the desktop file is changed when you install a new version of gvim, so you may need to repeat the following change after an update.

alias

You can ofcourse also use an alias:

% alias gvim 'gvim -p --remote-tab-silent'

Most GUI programs don't read aliases, but it is useful if you start gvim from the shell.

See also

Comments