gnvim
gnvim copied to clipboard
Changes silently lost if the editor window is closed
If i close the editor window with window close button, the changes in the open buffers are silently lost.
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.
Thanks, this is better than nothing, but I would expect a confirmation dialogue to appear. Maybe changes were unintentional.
If implementing confirmation dialogue is not yet planned, I think an acceptable workaround is to disable the window close button.
Same as #147?
Duplicate of #147.