Vim Tips Wiki
Register
Advertisement
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

Advertisement