Open salcode opened 7 years ago
" :W sudo saves the file
" (useful for handling the permission-denied error)
command W w !sudo tee % > /dev/null
from amix/vimrc
or
" Allow saving of files as sudo when I forgot to start vim using sudo.
cmap w!! w !sudo tee > /dev/null %
We had this previously but we had the %
before the >
, I'm not sure why this removed (or if if also gives the correct behavior).
See this explanation of why this works
See
:SudoWrite
from https://github.com/tpope/vim-eunuch as one possiblilityfor more information about the
sudo tee
trick see http://www.geekyboy.com/archives/629