init-shell.el 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. ;;; init-shell.el --- eshell/vterm Configuration File -*- lexical-binding: t -*-
  2. ;;; Commentary:
  3. ;;; Code:
  4. (use-feature eshell
  5. :bind ("C-x m " . eshell)
  6. :hook
  7. (eshell-pre-command . eshell-save-some-history)
  8. (eshell-mode-hook . (lambda () (setenv "TERM" "xterm-256color")))
  9. :custom
  10. (eshell-directory-name (expand-file-name "eshell" save-dir))
  11. (eshell-prompt-function
  12. ;; Based on https://www.reddit.com/r/emacs/comments/6f0rkz/my_fancy_eshell_prompt/
  13. (lambda ()
  14. (concat
  15. (propertize "┌─[" 'face `(:foreground "green"))
  16. (propertize (user-login-name) 'face `(:foreground "red"))
  17. (propertize "@" 'face `(:foreground "green"))
  18. (propertize (system-name) 'face `(:foreground "LightBlue"))
  19. (propertize "]──[" 'face `(:foreground "green"))
  20. (propertize (format-time-string "%H:%M" (current-time)) 'face `(:foreground "yellow"))
  21. (propertize "]──[" 'face `(:foreground "green"))
  22. (propertize (concat (eshell/pwd)) 'face `(:foreground "white"))
  23. (propertize "]\n" 'face `(:foreground "green"))
  24. (propertize "└─>" 'face `(:foreground "green"))
  25. (propertize (if (= (user-uid) 0) " # " " $ ") 'face `(:foreground "green")))))
  26. :config
  27. (setenv "PAGER" "cat"))
  28. (use-package eshell-z
  29. :hook (eshell-mode . (lambda () (require 'eshell-z))))
  30. (use-package eshell-syntax-highlighting
  31. :after esh-mode
  32. :config
  33. (eshell-syntax-highlighting-global-mode +1))
  34. (use-package xterm-color
  35. :after esh-mode
  36. :hook
  37. (eshell-before-prompt . (lambda ()
  38. (setq xterm-color-preserve-properties t)))
  39. :config
  40. (push 'xterm-color-filter eshell-preoutput-filter-functions)
  41. (delq 'eshell-handle-ansi-color eshell-output-filter-functions)
  42. (setenv "TERM" "xterm-256color"))
  43. ;; Installed with home-manager
  44. (use-feature multi-vterm
  45. :bind (("C-c t" . multi-vterm-next)
  46. ("C-x p t" . multi-vterm-project)
  47. ("C-c C-M-t" . multi-vterm)
  48. (:map vterm-mode-map
  49. ("M-[" . multi-vterm-prev)
  50. ("M-]" . multi-vterm-next))))
  51. (provide 'init-shell)
  52. ;;; init-shell.el ends here