Last active
June 1, 2024 13:47
-
-
Save alexispurslane/f60785a3895dd1d4487717e56f93349c to your computer and use it in GitHub Desktop.
Want to use Emacs's TRAMP to transparently enter containers you're using as distroboxes/devcontainers? Here's how.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun user/tramp-layer () | |
"Enable TRAMP to use distrobox to transparently enter containers." | |
(use-package tramp | |
:commands (eshell shell term ansi-term) | |
:custom | |
(tramp-histfile-override "/dev/null") | |
:config | |
(add-to-list 'tramp-remote-path 'tramp-own-remote-path) ; make sure TRAMP/any shell you use checks the path variable of the container as well as its own | |
(message "Loading tramp...") | |
;; TRAMP 2.7.1 will have distrobox built in, so this won't be necessary for much longer! | |
(add-to-list 'tramp-methods | |
`("distrobox" . ((tramp-login-program "distrobox-enter") | |
(tramp-login-args | |
(("%h") | |
("-e" "%l"))) | |
(tramp-remote-shell "/bin/sh") | |
(tramp-remote-shell-login ("-l")) | |
(tramp-remote-shell-args ("-i" "-c"))))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment