Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes silently lost if the editor window is closed #182

Closed
alexeymuranov opened this issue Oct 31, 2021 · 5 comments
Closed

Changes silently lost if the editor window is closed #182

alexeymuranov opened this issue Oct 31, 2021 · 5 comments

Comments

@alexeymuranov
Copy link

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

@alexeymuranov alexeymuranov changed the title Changes lost if the editor window is closed Changes silently lost if the editor window is closed Oct 31, 2021
@maage
Copy link

maage commented Nov 5, 2021

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
Copy link
Author

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

@alexeymuranov
Copy link
Author

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

@dbarnett
Copy link

Same as #147?

@vhakulinen
Copy link
Owner

Duplicate of #147.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants