Re:Just Use Sublime Text
by bzalasky on Thursday March 21, 2013 @03:30AM
(#5413539)
One time I started editing an nginx.conf file in nano while setting up a remote server on Linode. I forgot to sudo when I opened the file and couldn't save my changes. I might be an idiot here but (could I have resolved this in nano?)... but I'm fairly certain this would have been a non-issue in Vim.
[ Parent
| on HN ]
One simple solution that people often forget - at least I know I did in this situation is to save the file in home directory and then move it using su(do).
" Use w!! to sudo save after file is already opened
cmap w!! w !sudo tee % >/dev/null
See Nathan Long's awesome answer for an explanation:
http://stackoverflow.com/questions/2600783/how-does-the-vim-...