(Emacs/config)+eshell/sudo-switch function

This commit is contained in:
2024-07-27 04:37:12 +01:00
parent 6cbb8c37cc
commit 36ee9d9385
2 changed files with 6 additions and 0 deletions

View File

@@ -6,3 +6,4 @@ alias clear clear-scrollback
alias d dired-other-window $1
alias gt goto
alias pr project-root
alias ss sudo-switch

View File

@@ -41,6 +41,11 @@
(eshell/echo
(format "[%s]: No project in current directory" error-msg)))))
(defun eshell/sudo-switch (&rest args)
"Switch to a tramp connection sudo in the current directory"
(let ((wrapped-dir (concat "/sudo::" default-directory)))
(eshell/cd wrapped-dir)))
;; Additional functions
(defun +eshell/at-cwd ()
"Open an instance of eshell at the current working directory."