/raku/anagram/

les/'>dotfiles
My dotfilesdjm <djm@tilde.institute>
about summary refs log tree commit diff stats
path: root/.emacs.d/lisp/init-shell.el
blob: 8a64d4b7941cbf21dae265e67cce4da593dca9a7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
;;; init-shell.el --- eshell/vterm Configuration File -*- lexical-binding: t -*-
;;; Commentary:
;;; Code:

(use-feature eshell
  :bind ("C-x m " . eshell)
  :hook
  (eshell-pre-command . eshell-save-some-history)
  (eshell-mode-hook . (lambda () (setenv "TERM" "xterm-256color")))
  :custom
  (eshell-directory-name (expand-file-name "eshell" save-dir))
  (eshell-prompt-function
   ;; Based on https://www.reddit.com/r/emacs/comments/6f0rkz/my_fancy_eshell_prompt/
   (lambda ()
     (concat
      (propertize "┌─[" 'face `(:foreground "green"))
      (propertize (user-login-name) 'face `(:foreground "red"))
      (propertize "@" 'face `(:foreground "green"))
      (propertize (system-name) 'face `(:foreground "LightBlue"))
      (propertize "]──[" 'face `(:foreground "green"))
      (propertize (format-time-string "%H:%M" (current-time)) 'face `(:foreground "yellow"))
      (propertize "]──[" 'face `(:foreground "green"))
      (propertize (concat (eshell/pwd)) 'face `(:foreground "white"))
      (propertize "]\n" 'face `(:foreground "green"))
      (propertize "└─>" 'face `(:foreground "green"))
      (propertize (if (= (user-uid) 0) " # " " $ ") 'face `(:foreground "green")))))
  :config
  (setenv "PAGER" "cat"))

(use-package eshell-z
  :hook (eshell-mode . (lambda () (require 'eshell-z))))

(use-package eshell-syntax-highlighting
  :after esh-mode
  :config
  (eshell-syntax-highlighting-global-mode +1))

(use-package xterm-color
  :after esh-mode
  :hook
  (eshell-before-prompt . (lambda ()
                            (setq xterm-color-preserve-properties t)))
  :config
  (push 'xterm-color-filter eshell-preoutput-filter-functions)
  (delq 'eshell-handle-ansi-color eshell-output-filter-functions)
  (setenv "TERM" "xterm-256color"))

;; Installed with home-manager
(use-feature multi-vterm
  :bind (("C-c t" . multi-vterm-next)
         ("C-x p t" . multi-vterm-project)
         ("C-c C-M-t" . multi-vterm)
         (:map vterm-mode-map
               ("M-[" . multi-vterm-prev)
               ("M-]" . multi-vterm-next))))

(provide 'init-shell)
;;; init-shell.el ends here