Write vim file as super-user ?

Posted by zimbatm on Super User See other posts from Super User or by zimbatm
Published on 2010-05-26T16:24:11Z Indexed on 2010/05/26 16:33 UTC
Read the original article Hit count: 287

Filed under:

This is a usability problem that happens often to me :

I open a read-only system file with vim, even editing it, because I'm not attentive enough, or because the vim on the system is badly configured. Once my changes are done, I'm stuck having to write them in a temporary file or loosing them, because :w! won't work.

Is there a vim command (:W!!!) that allows you to write the current buffer as a super-user ? (Vim would ask for your sudo or su password naturally)

© Super User or respective owner

Related posts about vim