Vim: No write since last change, even though I changed the file

37,628

Solution 1

Try this, after editing your file, quit with this command: wq!. the ! means force the process, and when you combine it with wq that means force to save and quit.

Solution 2

The error message     "No write since last change"    that you encounter basically means that
you have not save to your file since the last editing, the write here have the same meaning as save.

If you want to save and then quit VIM, type the following
:wq Enter
or
you can also type the following
:w Enter     <-------- This command is to save the file
:q Enter     <-------- This command quit VIM


If you want to quit without saving any changes, type the following
:q! Enter

Share:
37,628
Lenny Will
Author by

Lenny Will

Updated on July 09, 2022

Comments

  • Lenny Will
    Lenny Will almost 2 years

    I'm trying to set up a file on my ubuntu machine, but when I try to change the contents before saving the file I've just created, vim returns the error: No write since last change.

    I've created the file with the user, who is trying to change the contents and sudo vim file.ext doesn't solve the problem eiter.

    Has anyone an idea?

    Best regards, Lenny

    EDIT:

    Basically, my workflow looks like this:

    touch file.js

    vim file.js In the file:

    console.log('Hello_world');
    

    Afterwards, I'm entering :q [Enter] and then the error message appears.

  • jitendra.khedar
    jitendra.khedar over 2 years
    :wq! worked for me
  • muratoner
    muratoner over 2 years
    :wq! suggestion worked!. Thanks 👍