:xit

:xit will write the current file only if there have been modifications to the file and then quit the window.
As opposed to using :w which will write the current file even if there haven't been any changes since the last write.
:xit is equivalent to :x, :exi, and :exit

Further Reading

:h :x :h :xa :h :xit

Latest Gifs

All Gifs