I've been working for quite some time now on a project, and one of the file got the read-only mode accidentally turned on, without me being aware of that. When i tried to write the file changes to the disk, the error E45: 'readonly' option is set (add ! to override) was raised, so i mindlessly typed the view! command, just to get all of the previous file changes vanished. I can't recall what i've done afterwards, but the undo command yields Already the newest change. Is there any way to fix that i.e. restore the bygone file changes!?
As when i said that i might can't recall what i've done exactly after executing view!, i might have potentially inserted a new line, and thus maybe that's the reason behind not being able to restore the content as the undo list or something like that got clobbered. If that can be meditated, than i would be really thankful for a solution.

  • 1
    Did you have 'undofile' enabled? If not, you're almost certainly out of luck.
    – Heptite
    Jun 15, 2022 at 15:03
  • @Heptite Unfortunately no, i don't
    – xquilt
    Jun 15, 2022 at 15:57
  • If you have a plugin like github.com/mbbill/undotree, you might try the undotree to see if you ended up in a different branch
    – D. Ben Knoble
    Jun 16, 2022 at 16:31


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.