neovim / python-gui

Proof-of-concept Nvim GUI. Not maintained.
Apache License 2.0
75 stars 20 forks source link

embeddable gtk widget #24

Open gour opened 8 years ago

gour commented 8 years ago

Hello,

recently I switched from Emacs to Vim and use it as external editor in Claws-mail by having the following line in Preferences:

gvim '+set filetype=mail' -f --socketid %w %s

Now, I'd like to switch to Neovim and after having some chat in #neovim, was advised to ask here if Neovim could be embedded into Claws via python-gui?

justinmk commented 8 years ago

--socketid is a feature shipped with some gtk versions of gvim. http://vimdoc.sourceforge.net/htmldoc/gui_x11.html#gui-gtk-socketid It implements GtkSocket interface which can be embedded in other GTK apps (such as Claws).

It appears pygtk has some support for this: http://www.pygtk.org/pygtk2reference/class-gtksocket.html

bfredl commented 8 years ago

This is definitely doable, just someone needs to put in the work to either refactor the python-gui to a widget + a command line interface to accept the socket id or (larger effort, but more widely usable) implement a nvim Gtk widget in C, possibly using @tarruda:s libmpack (I would imagine the widget taking an address/fd and communicate with nvim via gtk:s event loop, this usecase shouldn't need python-gui:s awkward two-thread indirecton).

Minor nit: we are using Gtk3 (and thus aren't constrained by what pygtk supported) but I would suppose the socket protocol to be the same (thin wrapper around XEmbed?).

bluss commented 7 years ago

Python 3 + Gtk 3 + gi still work well with Gtk.Socket and embedding vim. This is however a dying tech, only supported on X and not when using wayland.