Created
October 17, 2013 17:31
-
-
Save Superbil/7028971 to your computer and use it in GitHub Desktop.
auto use root to open file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defadvice ido-find-file | |
(after find-file-sudo activate) | |
"Find file as root if necessary." | |
(unless (and buffer-file-name | |
(file-writable-p buffer-file-name)) | |
(find-alternate-file (concat "/sudo:root@localhost:" | |
buffer-file-name)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment