Save & Exit Vim, :x or :wq ?

(#quickdrops 💧 from Twitter)


@rossijonas posted on twitter:

#vim #quickdrops 💧 Save & Exit Vim, :x or :wq ?

:wq! - It saves the file, even if there was no changes, and then quit.

:x - write only if change was made, and then quit.

If the file’s ‘last edit’ date/time attribute should not change unless the content was changed, use :x .

(👆 This is an affiliate link. If you got any value from this post and are also interested in buying the MVQ book/screencasts, please consider visiting the affiliate link and you’ll be gifting me a coffee ☕ or a beer 🍺.)


  • Follow me on Twitter to get more posts like this and other quick tips in your feed.
  • is the TRUE and FOREVER FREE home for the previously used publication. At you’ll always find all posts without restrictions.
  • If you have any doubts or tips about this article, I’d appreciate knowing and discussing it via email.
  • Do you have any other Vim tips? Would you like to publish that in this blog? Please send an email to vim drops.
  • As English is not my native language, I apologize for the errors. Corrections are welcome.
  • Contact: vim [@] alldrops [.] info.

Read more on vim drops: