write and save file in read-only mode in vim code example Example: vim save read only file :w !sudo tee % >/dev/null