Vim Tips Wiki
(Add aliases)
(Fix typos)
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 ==
+
==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>
Line 25: Line 25:
 
'''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.
 
'''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 ==
+
==alias==
You can ofcourse also use an <tt>alias</tt>:
+
You can of course also use an <tt>alias</tt>:
 
<pre>% alias gvim 'gvim -p --remote-tab-silent'</pre>
 
<pre>% alias gvim 'gvim -p --remote-tab-silent'</pre>
   

Revision as of 11:37, 31 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 of course 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