Live data from Hacker News

I Quit (Vim)

coffeemug.store

1–3 of 3 posts

Re: I Quit (Vim)

#2
I am learning new things about Vim all the time. Could someone tell me why the exclamation point at the end of `:wq`? I generally only use it when I'm not saving the buffer, like `:q!`.

Re: I Quit (Vim)

#3

I am learning new things about Vim all the time. Could someone tell me why the exclamation point at the end of `:wq`? I generally only use it when I'm not saving the buffer, like `:q!`.

:w! Forces write even if the file exists, eg is chmod -r read-only.

:q! quits even if the buffer isn't saved.

:wq! Forces write and quits anyway.

It can't always work,you have to own the file and have the correct permissions for the directory. Sudo root it overrides the file/dir chmod mask constraints. It can't write over chflags locked files.