diff --git a/init.el b/init.el index b88d467..605af1c 100644 --- a/init.el +++ b/init.el @@ -78,6 +78,7 @@ "fm" #'bookmark-set "ft" #'treemacs "fs" #'evil-write + "fu" #'my-sudo-edit "f'" #'bookmark-jump "gg" #'magit-status "mm" #'minimap-mode @@ -506,6 +507,13 @@ (add-to-list 'after-make-frame-functions #'frame-make-detect-term) +(defun my-sudo-edit () + "Edit current file as root." + (interactive) + (unless (and buffer-file-name + (file-writable-p buffer-file-name)) + (find-alternate-file (concat "/sudo:root@localhost:" buffer-file-name)))) + (add-to-list 'auto-mode-alist '("\\.yuck\\'" . lisp-mode)) (add-to-list 'auto-mode-alist '("flake\\.lock\\'" . js-json-mode))