GNOME Bugzilla – Bug 154621
Insert file...
Last modified: 2019-03-23 20:35:14 UTC
Emacs and XEmacs can insert a file in the place where the curser is. I think it is a important feature in an editor to have.
I don't think it is a very frequent operation, and the few times it happens people will just open the file, select all and paste the contents. That said, implementing the feature as a plugin should be fairly simple.
You are probably right a plugin would suite better for this... Thanks for your reply.
Created attachment 56581 [details] Insert file python plugin Here is a python plugin that implements the insert file functionality
Nice... The "right" way to do it would be to use gedit's functions to load a file, but given that we have not provided such an api yet your plugin does the trick. The problem with such an approach are that 1) works only for local files and 2) it blocks the gedit interface during I/O
Another way to create an "Insert File" function: -gedit->Tools->External Tools... -click on New, name it "Insert File" -Description=Insert a file at current cursor position -Commands: #!/bin/sh cat "`zenity --file-selection --title="Select File to Insert - gedit" `" -Input: Nothing -Output: Insert at cursor position -Applicability: All documents It requires you to have zenity installed. Works for me...
This is also possible with a snippet (for example with dnd). I'm closing this bug.