diff options
author | Aryadev Chavali <aryadev@aryadevchavali.com> | 2024-07-27 04:37:12 +0100 |
---|---|---|
committer | Aryadev Chavali <aryadev@aryadevchavali.com> | 2024-07-27 04:37:12 +0100 |
commit | 36ee9d938596fe4a274e81efc722c8b420832480 (patch) | |
tree | f004bddb93fbee1bc9d55f472a007ca92fad52c8 | |
parent | 6cbb8c37cc9feb263e28fe17e1f3e52609697ce7 (diff) | |
download | dotfiles-36ee9d938596fe4a274e81efc722c8b420832480.tar.gz dotfiles-36ee9d938596fe4a274e81efc722c8b420832480.tar.bz2 dotfiles-36ee9d938596fe4a274e81efc722c8b420832480.zip |
(Emacs/config)+eshell/sudo-switch function
-rw-r--r-- | Emacs/.config/emacs/.config/eshell/aliases | 1 | ||||
-rw-r--r-- | Emacs/.config/emacs/elisp/eshell-additions.el | 5 |
2 files changed, 6 insertions, 0 deletions
diff --git a/Emacs/.config/emacs/.config/eshell/aliases b/Emacs/.config/emacs/.config/eshell/aliases index c7effa4..7aac3d4 100644 --- a/Emacs/.config/emacs/.config/eshell/aliases +++ b/Emacs/.config/emacs/.config/eshell/aliases @@ -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
\ No newline at end of file diff --git a/Emacs/.config/emacs/elisp/eshell-additions.el b/Emacs/.config/emacs/elisp/eshell-additions.el index 931b89b..6c1147e 100644 --- a/Emacs/.config/emacs/elisp/eshell-additions.el +++ b/Emacs/.config/emacs/elisp/eshell-additions.el @@ -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." |