I was thrilled to notice a GNOME launcher for
vim in the
vim-common package after I upgraded to Ubuntu 16.04, since it offers an alternative to
gvim (a solid app, though not perfect for my workflow). But there is a problem with the
vim launcher, reproduced easily as follows:
- Right-click a file and Open With > Vim (not Gvim!)...
vimruns on your file in a terminal.
- Make some changes, but don't save them.
- Close the window from the title bar, as you would close
gvimor any other app with pending changes.
- The changes are lost, since the
vimprocess dies along with the terminal (leaving a swapfile)
I'd like to find a best-practice way of fixing the
vim.desktop file (system version in
/usr/share/applications) to make the
vim launcher a viable alternative to
gvim, since that default launcher is like an accident waiting to happen.
Terminal=true seems like a given, but
Exec=vim %F is vulnerable to the window dying and therefore should be replaced with a wrapper script... but I need advice on
- how that wrapper might handle the signal of the parent terminal dying
- how to handle the dialogue with the user about saving the file
It seems to me like the second of these tasks is impossible, since you'd have to do IPC with the
vim session itself to demand the file be saved or abandoned, according to the user's choice... but I thought I'd ask here before giving up.
I already know
gvim is a workaround but that wouldn't be an answer to the question itself. I am just surprised that this weak
vim launcher is provided with Ubuntu & other distros when it invites catastrophe into the editing process.