write change with vim with root code example Example 1: vim save sudo :w !sudo tee % Example 2: take sudo access inside vim w !sudo tee %