]> git.bundesbrandschatzamt.de Git - emacsconfig.git/commitdiff
bba-eshell-host
authorAndreas Gerler <baronNOSPAMbundesbrandschatzamt.de>
Wed, 10 Dec 2025 12:37:43 +0000 (13:37 +0100)
committerAndreas Gerler <baronNOSPAMbundesbrandschatzamt.de>
Wed, 10 Dec 2025 12:37:43 +0000 (13:37 +0100)
* bba-shell.org: insert the current remote host as a root directory.

bba-shell.org

index 9a253d6e5d4db75d39727e2601834270dcfa8ecc..956eaea44d2e77b60c43e240dcd7f73c9c4253ef 100644 (file)
@@ -123,6 +123,23 @@ A little bit of code from https://github.com/bodil/emacs.d/blob/master/bodil/bod
   (eshell/cd (format "%s%s" host new-path))))
 #+end_src
 
+Better than a specific cd command we can insert the current remote
+host.
+
+#+begin_src elisp
+  (defun bba-eshell-host()
+    (interactive)
+    (let* ((d default-directory)
+           (s (split-string d ":"))
+           (path (car (last s)))
+           (l (length path))
+           (host (substring d 0 (- (length d) l))))
+      (insert host)))
+
+  (define-key eshell-mode-map (kbd "s-i") 'bba-eshell-host)
+#+end_src
+
+
 ** [[https://codeberg.org/akib/emacs-eat/][eat]]
 [2024-02-05 Mon 12:10]