How to force write (`:w!`) and quit (`:q`) vim in the same command?

How can I force write (:w!) and quit (:q) vim in the same command? I try :w!q but that doesn’t work.

Asked By: a06e

||

The vim idiom is :wq!. Another read of man vim is indicated.

Answered By: waltinator

As mentioned in other answer you can use command like:

:wq!

But you can simplify the command by enter:

:x!

(x=wq in this case)

Maybe you can consider reading this answer in StackOverflow.

Answered By: Romeo Ninov
Categories: Answers Tags:
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.