Open Multiple Text Files as Tabs in GVim on KDE 4
This journal is on how to open multiple text files from Dolphin file manager and display them as tabs in GVim. In this example I’m using Linux Mint 9 KDE with KDE 4.4.5 on it.
Linux Mint KDE is my primary workstation at home and I think Dolphin is the best file manager for Linux. I use Dolphin to navigate my workspace and source codes. Many times I use Right-Click -> “Open With” -> “GVim Text Editor” to quickly edit files. The issue is that the default behavior will spawn multiple instances of GVim for each files while what I want is for GVim to have one instance only and open those files in tabs.
To change it we need to modify on how GVim got spawned by Dolphin. On Linux Mint 10 it’s defined in a file /usr/share/applications/gvim.desktop which we need to edit.
Inside that file we need to change 2 lines. The first one is the “Exec” line. On my machine by default it says:
Exec=gvim -f %F
We need to change it to:
Exec=/usr/bin/gvim -font "Inconsolata Medium 11" --remote-tab-silent %F
The flag “–remote-tab-silent” will make GVim stays with one instance only while the -font flag will tell GVim to load specific fonts instead of default one.
The second line that we need to change is the “StartupNotify“. By default on my machine it says:
I just change it to:
without flipping it to false whenever GVim got spawned it will also spawn a shell in the background.