Set up eshell
This commit is contained in:
parent
a3d4ba6327
commit
983fc50ab4
44
emacs/.emacs.d/config/init-eshell.el
Normal file
44
emacs/.emacs.d/config/init-eshell.el
Normal file
@ -0,0 +1,44 @@
|
||||
(use-package eshell
|
||||
:straight (:type built-in)
|
||||
:config
|
||||
;; Easy binding to get an eshell
|
||||
(defun open-eshell (&optional arg)
|
||||
(interactive "P")
|
||||
(if (and (fboundp 'projectile-project-root)
|
||||
(projectile-project-root))
|
||||
(projectile-run-eshell arg)
|
||||
(eshell arg)))
|
||||
|
||||
;; Actually clear the eshell buffer
|
||||
(defun clear-eshell (&optional prefix)
|
||||
(interactive)
|
||||
(let ((input (eshell-get-old-input)))
|
||||
(eshell/clear-scrollback)
|
||||
(eshell-emit-prompt)
|
||||
(insert input)))
|
||||
(add-hook 'eshell-mode-hook
|
||||
(lambda () (general-def eshell-mode-map "C-c C-o" #'clear-eshell)))
|
||||
|
||||
(evil-collection-eshell-setup)
|
||||
|
||||
;; Gotta have a good prompt
|
||||
(defun jdormit-eshell-prompt ()
|
||||
(let ((branch (magit-name-local-branch "HEAD")))
|
||||
(format "%s%s"
|
||||
(if branch (format "(%s) " branch) "")
|
||||
(concat (abbreviate-file-name (eshell/pwd))
|
||||
" "
|
||||
(propertize
|
||||
(if (= (user-uid) 0) "#" "λ")
|
||||
'face `(:foreground "#859900"))
|
||||
" "))))
|
||||
|
||||
(setq jdormit-eshell-prompt-regex "^[^#λ\n]* [#λ] ")
|
||||
(setq eshell-prompt-function 'jdormit-eshell-prompt)
|
||||
(setq eshell-prompt-regexp jdormit-eshell-prompt-regex)
|
||||
:general
|
||||
(leader-map "'" #'open-eshell)
|
||||
:custom
|
||||
(eshell-cmpl-cycle-completions nil))
|
||||
|
||||
(provide 'init-eshell)
|
@ -1,5 +1,9 @@
|
||||
;; Magit!
|
||||
(use-package magit
|
||||
:commands (magit-status
|
||||
magit-file-dispatch
|
||||
magit-dispatch
|
||||
magit-name-local-branch)
|
||||
:init
|
||||
(leader-def-key "g" '(nil :which-key "git"))
|
||||
:config
|
||||
|
@ -54,6 +54,7 @@
|
||||
(require 'init-projects)
|
||||
(require 'init-git)
|
||||
(require 'init-ide)
|
||||
(require 'init-eshell)
|
||||
|
||||
;; Load the custom file
|
||||
(when (file-exists-p custom-file)
|
||||
|
Loading…
Reference in New Issue
Block a user