automatically sudoedit root-owned files

This commit is contained in:
MitchMarq42 2023-01-25 10:48:11 -09:00
parent 10e239d42d
commit 6af8f9414c

View File

@ -46,7 +46,13 @@
:ensure nil :ensure nil
;; :after eshell ;; :after eshell
:custom (tramp-persistency-file-name :custom (tramp-persistency-file-name
(expand-file-name "tramp-history" backup-directory))) (expand-file-name "tramp-history" backup-directory))
:config
(defun find-file-sudo (&rest throwaway)
(unless (and buffer-file-name
(file-writable-p buffer-file-name))
(find-alternate-file (concat "/sudo:root@localhost:" buffer-file-name))))
(advice-add #'find-file :after #'find-file-sudo))
;; Visualize whitespace. In a very chill and invisible way. ;; Visualize whitespace. In a very chill and invisible way.
(elpaca-use-package whitespace (elpaca-use-package whitespace
:ensure nil :ensure nil