Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Have nautilus open file into new gvim buffer?

Is there a way to configure nautilus to open a file into an existing gvim process in a new buffer instead of loading a new instance of gvim? I know I can drag and drop the file into gvim, but it would be convenient if I could just double-click a file to open it.

like image 825
CMB Avatar asked Aug 24 '09 17:08

CMB


2 Answers

In a Terminal

cd ~/.local/share/applications
vi gvim-tab.desktop

Copy Paste this code :

[Desktop Entry]
Encoding=UTF-8
Name=GVim Text Editor (Tabs)
Comment=Edit text files in a new tab
Exec=gvim --remote-tab %F
Terminal=false
Type=Application
Icon=/usr/share/pixmaps/vim.svg
Categories=Application;Utility;TextEditor;
StartupNotify=true
MimeType=text/plain;
NoDisplay=true

In Nautilus

Right-Click in a text file
Open With
Open with a another application
Select "GVim Text Editor (Tabs)"

It's done

like image 102
Touv Avatar answered Nov 03 '22 14:11

Touv


You're really just wanting to launch gVim with the --remote-tab-silent option. From the manual:-

                            *--remote-tab-silent*
   --remote-tab-silent
   Like --remote-silent but open each file in a new tabpage.

Also just check out --remote-silent if you're not wanting a new tab and want to create a new buffer.

like image 38
Gavin Gilmour Avatar answered Nov 03 '22 12:11

Gavin Gilmour