summaryrefslogtreecommitdiff
path: root/.config/emacs/modules/bd--shells.el
blob: 309d7ec0194758a1a598df456f72b50873ff0a4d (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
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
59
60
;;; -*- lexical-binding: t; -*-
;;; Commentary:
;;; Code:


;;;; term
(with-eval-after-load "term" (defalias 'term 'ansi-term))

;;;; eshell
;; path
(add-to-list 'exec-path "/home/bdunahu/.local/bin")

;; alias

;; completions
(require 'esh-mode)
(keymap-set eshell-mode-map "<tab>" 'completion-at-point)
(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"))

;; prompt
(defun bd/get-prompt-path ()
  (abbreviate-file-name (eshell/pwd)))

(defun bd/eshell-prompt ()
  "Return a prettified shell prompt."
  (concat
   "\n"
   (propertize (system-name) 'face `(:foreground ,(ef-themes-get-color-value 'yellow-warmer)))
   (propertize (format " %s" (bd/get-prompt-path)) 'face `(:foreground ,(ef-themes-get-color-value 'blue-warmer)))
   (propertize (format-time-string " %a, %R") 'face `(:foreground ,(ef-themes-get-color-value 'blue-faint)))
   (propertize "\n> " 'face `(:foreground ,(ef-themes-get-color-value 'red)))))

(defun eshell/clear (&optional scrollback)
  "Override of default function. Scroll contents of eshell window
out of sight, leaving a blank window. If SCROLLBACK is non-nil,
clear the scrollback contents. Outputs banner message."
  (interactive)
  (if scrollback
      (eshell/clear-scrollback)
    (let ((eshell-input-filter-functions nil))
      (insert (make-string (window-size) ?\n))
      (eshell-send-input)
      (unless eshell-non-interactive-p
        (eval eshell-banner-message)))))


;;;; 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)
;;; bd-shells ends here