Joined November 2012
·

Ryan Rix

Tempe, AZ
·
·

Posted to Add sudo after opening a file in vim over 1 year ago

Train yourself with this in your local vimrc:

command! Sudo echo "w !sudo tee % >/dev/null"

Then :Sudo will remind you what the command is every time and drill it in to your brain; of course, if you're only using this on a single machine or you have your vimrc in a source control repo that's easy to install:

command! Sudo w !sudo tee % >/dev/null
Posted to Prevent VIM write misfires over 1 year ago

Maps like these are bad form; remember that not every server or machine you're on is going to have these maps and you're using them as a crutch. Don't fall over, now :)

Achievements
155 Karma
2,094 Total ProTip Views