Add doom/sudo-find-file
This commit is contained in:
parent
0bc1939ae5
commit
b425f45875
1 changed files with 8 additions and 0 deletions
|
@ -1,5 +1,13 @@
|
||||||
;;; editor.el
|
;;; editor.el
|
||||||
|
|
||||||
|
;;;###autoload
|
||||||
|
(defun doom/sudo-find-file ()
|
||||||
|
"Open a file as root."
|
||||||
|
(interactive)
|
||||||
|
(let ((file (read-file-name "Open as root: ")))
|
||||||
|
(unless (file-writable-p file)
|
||||||
|
(find-file (concat "/sudo:root@localhost:" file)))))
|
||||||
|
|
||||||
(defun doom--goto-first-non-blank ()
|
(defun doom--goto-first-non-blank ()
|
||||||
(beginning-of-visual-line)
|
(beginning-of-visual-line)
|
||||||
(skip-chars-forward " \t\r"))
|
(skip-chars-forward " \t\r"))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue