mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-03 12:27:26 -05:00
Add doom/sudo-find-file
This commit is contained in:
@ -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"))
|
||||||
|
Reference in New Issue
Block a user