sudo vim AFTER you typed

in Debian

Ever typed something in vi or vim and minutes later, realized you don’t have permission to save what you typed?

I was looking up how to goto a line in VIM, and found a great article that had the method of going to a line (:1322 if you wanted to go to link 1322), and I found a gem:

How to sudo vim AFTER you’ve already typed

http://vim.wikia.com/wiki/Su-write says:


:w !sudo tee % > /dev/null

{ 0 comments… add one now }

Leave a Comment

Previous post:

Next post: