About Me

My photo
Working as Technical Lead in CollabNET software private limited.

Friday, 31 August 2012

VIM command to save the read only opened file with sudo permission

Most of the times, we get stuck on saving a vim editor contents as we would have been editing in a read-only mode. Normally when I face this situation, I use to exit the vim editor and re-open it with sudo permission and start my work all again. This command help me today to get rid of this pain. Yup, saving the read-only mode opened files with sudo permission with in the same shell. :w !sudo tee %