/blog/posts
Sunday, December 5, 2010
Sudo in Vim
If you often forget to add sudo before editing system files with vim, you can map w!!/x!! commands to save it without reentering the editor:
cmap w!! w !sudo tee %<cr><cr>:e!<cr>
cmap x!! w !sudo tee %<cr><cr>:q!<cr>
Where :e reloads a file.
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment