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