From bd688bdc866d3bba3bd6672e091746127ca54734 Mon Sep 17 00:00:00 2001 From: SqrtMinusOne Date: Sun, 24 Jul 2022 19:36:39 +0300 Subject: [PATCH] feat(emacs): eshell & shell stuff --- .emacs.d/init.el | 16 +++++++++++++--- Emacs.org | 23 +++++++++++++++++++---- 2 files changed, 32 insertions(+), 7 deletions(-) diff --git a/.emacs.d/init.el b/.emacs.d/init.el index 9e62c72..ab8789c 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -3924,6 +3924,7 @@ With ARG, repeats or can move backward if negative." (aweshell-alert-buffer-face :background (color-darken-name (doom-color 'bg) 3)) (aweshell-alert-command-face :foreground (doom-color 'red) :weight 'bold)) :config + (setq eshell-prompt-regexp "^[^#\nλ]* λ[#]* ") (setq eshell-highlight-prompt nil) (setq eshell-prompt-function 'epe-theme-pipeline)) @@ -3932,13 +3933,22 @@ With ARG, repeats or can move backward if negative." :if (not my/slow-ssh) :straight (eshell-info-banner :type git :host github - :repo "phundrak/eshell-info-banner.el") - :hook (eshell-banner-load . eshell-info-banner-update-banner)) + :repo "SqrtMinusOne/eshell-info-banner.el") + :hook (eshell-banner-load . eshell-info-banner-update-banner) + :config + (setq eshell-info-banner-filter-duplicate-partitions t) + (setq eshell-info-banner-exclude-partitions '("b/efi"))) -(when my/slow-ssh +(when (or my/slow-ssh my/remote-server) (general-nmap "`" 'aweshell-dedicated-toggle) (general-nmap "~" 'eshell)) +(defun my/setup-shell () + (setq-local comint-use-prompt-regexp t) + (setq-local comint-prompt-read-only t)) + +(add-hook 'shell-mode-hook #'my/setup-shell) + (general-define-key ;; "C-c c" (my/command-in-persp "Emacs.org" "conf" 1 (find-file "~/Emacs.org")) "C-c c" `(,(lambda () (interactive) (find-file "~/Emacs.org")) :wk "Emacs.org")) diff --git a/Emacs.org b/Emacs.org index 6e205b3..9b50343 100644 --- a/Emacs.org +++ b/Emacs.org @@ -5777,6 +5777,7 @@ That is, with the help of [[file:Console.org::Functions][this function]], I can #+end_src *** Eshell A shell written in Emacs lisp. I don't use it as of now, but keep the config just in case. + #+begin_src emacs-lisp (defun my/configure-eshell () (add-hook 'eshell-pre-command-hook 'eshell-save-some-history) @@ -5821,7 +5822,8 @@ A shell written in Emacs lisp. I don't use it as of now, but keep the config jus (aweshell-alert-buffer-face :background (color-darken-name (doom-color 'bg) 3)) (aweshell-alert-command-face :foreground (doom-color 'red) :weight 'bold)) :config - (setq eshell-highlight-prompt nil) + (setq eshell-prompt-regexp "^[^#\nλ]* λ[#]* ") + (setq eshell-highlight-prompt t) (setq eshell-prompt-function 'epe-theme-pipeline)) (use-package eshell-info-banner @@ -5829,13 +5831,26 @@ A shell written in Emacs lisp. I don't use it as of now, but keep the config jus :if (not my/slow-ssh) :straight (eshell-info-banner :type git :host github - :repo "phundrak/eshell-info-banner.el") - :hook (eshell-banner-load . eshell-info-banner-update-banner)) + :repo "SqrtMinusOne/eshell-info-banner.el") + :hook (eshell-banner-load . eshell-info-banner-update-banner) + :config + (setq eshell-info-banner-filter-duplicate-partitions t) + (setq eshell-info-banner-exclude-partitions '("b/efi"))) -(when my/slow-ssh +(when (or my/slow-ssh my/remote-server) (general-nmap "`" 'aweshell-dedicated-toggle) (general-nmap "~" 'eshell)) #+end_src +*** Shell +Interactive subshell (=M-x shell=) is a way to run commands with input and output through an Emacs buffer. + +#+begin_src emacs-lisp +(defun my/setup-shell () + (setq-local comint-use-prompt-regexp t) + (setq-local comint-prompt-read-only t)) + +(add-hook 'shell-mode-hook #'my/setup-shell) +#+end_src ** Managing dotfiles A bunch of functions for managing dotfiles with yadm.