Refactor eshell integration
This commit is contained in:
parent
8a666aedfe
commit
caae5946cf
2 changed files with 89 additions and 43 deletions
|
@ -1,37 +1,52 @@
|
|||
;;; module-eshell.el --- -*- no-byte-compile: t; -*-
|
||||
|
||||
(use-package eshell
|
||||
:when IS-WINDOWS
|
||||
:init
|
||||
(evil-set-initial-state 'eshell-mode 'emacs)
|
||||
(setq eshell-directory-name (concat doom-temp-dir "/eshell")
|
||||
eshell-scroll-to-bottom-on-input 'all
|
||||
eshell-scroll-to-bottom-on-output 'all
|
||||
eshell-buffer-shorthand t
|
||||
;; em-prompt
|
||||
eshell-prompt-function 'doom/eshell-prompt
|
||||
;; em-glob
|
||||
eshell-glob-case-insensitive t
|
||||
eshell-error-if-no-glob t
|
||||
eshell-where-to-jump 'end
|
||||
;; em-alias
|
||||
eshell-aliases-file (concat doom-temp-dir "/.eshell-aliases"))
|
||||
|
||||
:config
|
||||
(def-popup! eshell-mode :frame t :select t)
|
||||
(evil-set-initial-state 'eshell-mode 'insert)
|
||||
|
||||
;; plan 9 smart shell
|
||||
(require 'em-smart)
|
||||
(push 'eshell-smart eshell-modules-list)
|
||||
(setq eshell-where-to-jump 'begin)
|
||||
(setq eshell-review-quick-commands nil)
|
||||
(setq eshell-smart-space-goes-to-end t)
|
||||
;; em-prompt
|
||||
(setq eshell-prompt-function 'doom/eshell-prompt)
|
||||
(map! :map eshell-mode-map
|
||||
:n "i" 'doom/eshell-evil-prepend-maybe
|
||||
:n "I" 'doom/eshell-evil-prepend
|
||||
:n "a" 'doom/eshell-evil-append-maybe
|
||||
:n "A" 'doom/eshell-evil-append
|
||||
:n "r" 'doom/eshell-evil-replace-maybe
|
||||
:n "R" 'doom/eshell-evil-replace-state-maybe))
|
||||
(defun doom|eshell-keymap-setup ()
|
||||
(map! :map eshell-mode-map
|
||||
:n "i" 'doom/eshell-evil-prepend-maybe
|
||||
:n "I" 'doom/eshell-evil-prepend
|
||||
:n "a" 'doom/eshell-evil-append-maybe
|
||||
:n "A" 'doom/eshell-evil-append
|
||||
:n "r" 'doom/eshell-evil-replace-maybe
|
||||
:n "R" 'doom/eshell-evil-replace-state-maybe
|
||||
:i "C-u" 'eshell-kill-input
|
||||
:i "SPC" 'self-insert-command
|
||||
:m "<return>" 'doom/eshell-evil-append
|
||||
:n [remap doom/evil-window-split] 'doom/eshell-split
|
||||
:n [remap doom/evil-window-vsplit] 'doom/eshell-vsplit))
|
||||
|
||||
(defun doom|eshell-init ()
|
||||
(when (eq major-mode 'eshell-mode)
|
||||
(add-to-list 'doom-eshell-buffers (current-buffer))))
|
||||
|
||||
(defun doom|eshell-cleanup ()
|
||||
(when (eq major-mode 'eshell-mode)
|
||||
(setq doom-eshell-buffers (delete (current-buffer) doom-eshell-buffers))
|
||||
(delete-window)))
|
||||
|
||||
;; Close window on exit
|
||||
(add-hook 'eshell-exit-hook 'doom|eshell-cleanup)
|
||||
(add-hook 'eshell-mode-hook 'doom|eshell-init)
|
||||
|
||||
(add-hook 'eshell-mode-hook 'doom|eshell-keymap-setup)
|
||||
(add-hook 'eshell-mode-hook 'doom-hide-mode-line-mode)
|
||||
(add-hook 'eshell-mode-hook 'hl-line-mode))
|
||||
|
||||
(provide 'module-eshell)
|
||||
;;; module-eshell.el ends here
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue