This question already asked years ago and still tricky for some engineers.
Few approaches on exiting vim that I know :
- using :wq
- using :x
- close terminal (please don't)
- turnoff the PC (please don't)
Today I learnt that :x and :wq are not the same thing! Both command will save and quit, but there is one difference.
:wq
will write your buffer to disk and update modification timestamp.
:x
will only write when there is any changes on your buffer. If your buffer remain the same, then the modification timestamp will be untouched.