:wq! command in vim

If you don’t have permission to the file (e.g. you don’t own the file), then it will not force the write. If you do have permission to the file, but it is a read-only file, then you can force-write it. It’s as if you first change the file mode to writable, write your changes, and then change the file mode back to read-only.

Leave a Comment