summaryrefslogtreecommitdiff
path: root/.config/emacs/bd-shells.el
blob: 4e3a7b49600712a80df19c5f7535f506e81034ce (plain)
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
;; -*- lexical-binding: t; -*-


(use-package term
  :config
  (defalias 'term 'ansi-term))

(use-package eshell
  :demand
  :after (magit all-the-icons)
  :init
  (defun bd/get-prompt-path ()
    (abbreviate-file-name (eshell/pwd)))

  (defun bd/eshell-prompt ()
    (let ((current-branch (magit-get-current-branch)))
      (concat
       "\n"
       (propertize (system-name) 'face `(:foreground "#edb54b"))
       (when current-branch
         (concat
          (format " %s " (all-the-icons-octicon "git-branch"))
          (propertize current-branch 'face `(:foreground "#98d1ce"))))
       (format " %s " (all-the-icons-fileicon "gn"))
       (propertize (bd/get-prompt-path) 'face `(:foreground "#33859d"))
       (propertize "\n> " 'face `(:foreground "#c33027")))))
  :bind (:map eshell-mode-map
              ("<tab>" . completion-at-point))
  :custom
  (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")))