From 1ced565816120bfcc351daf9fc3a4e851162e3b7 Mon Sep 17 00:00:00 2001 From: bd Date: Wed, 10 Jan 2024 19:44:21 -0700 Subject: Initial commit of new repository structure --- .config/emacs/modules/bd--shells.el | 57 +++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 .config/emacs/modules/bd--shells.el (limited to '.config/emacs/modules/bd--shells.el') diff --git a/.config/emacs/modules/bd--shells.el b/.config/emacs/modules/bd--shells.el new file mode 100644 index 0000000..8bcd9c4 --- /dev/null +++ b/.config/emacs/modules/bd--shells.el @@ -0,0 +1,57 @@ +;; -*- lexical-binding: t; -*- + + +(require 'all-the-icons) + + +;;;; term +(defalias 'term 'ansi-term) + + +;;;; eshell +(defun eshell-open-buffer () + "Opens eshell in the bottom +side window." + (interactive) + (let ((curr-buffer (current-buffer)) + (eshell (eshell))) + (switch-to-buffer curr-buffer) + (display-buffer-in-side-window (get-buffer eshell) '((side . top))) + (switch-to-buffer-other-window eshell))) + + +(defun bd/get-prompt-path () + (abbreviate-file-name (eshell/pwd))) + +(defun bd/eshell-prompt () + "Assemble a shell prompt including host, git +status, and path." + (concat + "\n" + (propertize (system-name) 'face `(:foreground "#edb54b")) + (format " %s " (all-the-icons-fileicon "gn")) + (propertize (bd/get-prompt-path) 'face `(:foreground "#33859d")) + (propertize (format-time-string " %a, %R") 'face `(:foreground "#888ba5")) + (propertize "\n> " 'face `(:foreground "#c33027")))) + + +(require 'esh-mode) +(keymap-global-set "C-z C-e" 'eshell-open-buffer) +(keymap-set eshell-mode-map "C-q" 'delete-window) ; mostly for side window +(keymap-set eshell-mode-map "" 'completion-at-point) ; mostly for side window +(setopt eshell-prompt-function 'bd/eshell-prompt + eshell-prompt-regexp "^> " + eshell-scroll-to-bottom-on-input 'this + eshell-banner-message (concat "\n" (propertize " " 'display (create-image (expand-file-name "~/.config/emacs/images/raven.png") 'png nil :scale 0.2 :align-to "center")) "\n")) + + +;;;; shell +(require 'shell) +(keymap-set shell-mode-map "C-c C-k" #'comint-clear-buffer) +(setopt shell-command-prompt-show-cwd t + shell-highlight-undef-enable t + shell-kill-buffer-on-exit t + comint-prompt-read-only t) + + +(provide 'bd--shells) -- cgit v1.2.3