Skip to content

Instantly share code, notes, and snippets.

@Superbil
Created October 17, 2013 17:31
Show Gist options
  • Save Superbil/7028971 to your computer and use it in GitHub Desktop.
Save Superbil/7028971 to your computer and use it in GitHub Desktop.
auto use root to open file
(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