简体   繁体   中英

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.

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM