vhakulinen / gnvim

GUI for neovim, without any web bloat
MIT License
1.84k stars 69 forks source link

Changes silently lost if the editor window is closed #182

Closed alexeymuranov closed 1 year ago

alexeymuranov commented 2 years ago

If i close the editor window with window close button, the changes in the open buffers are silently lost.

maage commented 2 years ago

You can fix this with configuration.

Add: ~/.config/nvim/init.vim

set autowriteall

Or if you want to protect against crashes too, also add:

augroup AUTOSAVE
  au!
  autocmd InsertLeave,TextChanged,TextChangedI,FocusLost * silent! write
augroup END

If you normally edit huge files, this might not be a good idea though, as there will be much autosaving there.

From :h 'autowriteall'

'autowriteall' 'awa'    boolean (default off)
                        global
        Like 'autowrite', but also used for commands ":edit", ":enew", ":quit",
        ":qall", ":exit", ":xit", ":recover" and closing the Vim window.
        Setting this option also implies that Vim behaves like 'autowrite' has
        been set.
alexeymuranov commented 2 years ago

Thanks, this is better than nothing, but I would expect a confirmation dialogue to appear. Maybe changes were unintentional.

alexeymuranov commented 2 years ago

If implementing confirmation dialogue is not yet planned, I think an acceptable workaround is to disable the window close button.

dbarnett commented 2 years ago

Same as #147?

vhakulinen commented 1 year ago

Duplicate of #147.