Add sudo edit command
This commit is contained in:
parent
910628a012
commit
71636c085f
8
init.el
8
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))
|
||||
|
||||
|
|
Loading…
Reference in a new issue