Launch files in new tabs under Unix
From Vim Tips Wiki
Tip 1552 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.
Contents |
[edit] 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.
[edit] 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.
