2017-06-08 11:47:56 +02:00
|
|
|
;;; tools/eshell/config.el -*- lexical-binding: t; -*-
|
2017-02-19 18:53:38 -05:00
|
|
|
|
|
|
|
;; This is highly experimental. I don't use eshell often, so this may need work.
|
|
|
|
|
|
|
|
;; see:
|
2017-09-27 12:42:24 +02:00
|
|
|
;; + `+eshell/open': open in current buffer
|
|
|
|
;; + `+eshell/open-popup': open in a popup
|
2018-01-15 00:43:17 -05:00
|
|
|
;; + `+eshell/open-workspace': open in separate tab (requires :feature
|
|
|
|
;; workspaces)
|
2017-02-19 18:53:38 -05:00
|
|
|
|
2017-02-23 00:06:12 -05:00
|
|
|
(def-package! eshell ; built-in
|
2017-09-27 12:42:24 +02:00
|
|
|
:commands eshell-mode
|
2017-02-19 18:53:38 -05:00
|
|
|
:init
|
2017-11-04 22:34:55 +01:00
|
|
|
(setq eshell-directory-name (concat doom-etc-dir "/eshell")
|
2017-02-19 18:53:38 -05:00
|
|
|
eshell-scroll-to-bottom-on-input 'all
|
|
|
|
eshell-scroll-to-bottom-on-output 'all
|
|
|
|
eshell-buffer-shorthand t
|
2017-05-12 12:10:04 +02:00
|
|
|
eshell-kill-processes-on-exit t
|
2017-02-19 18:53:38 -05:00
|
|
|
;; em-prompt
|
2017-07-21 16:48:34 +02:00
|
|
|
eshell-prompt-regexp "^.* λ "
|
2017-09-27 12:42:24 +02:00
|
|
|
eshell-prompt-function #'+eshell-prompt
|
2017-02-19 18:53:38 -05:00
|
|
|
;; em-glob
|
|
|
|
eshell-glob-case-insensitive t
|
|
|
|
eshell-error-if-no-glob t
|
|
|
|
;; em-alias
|
2017-04-17 02:20:07 -04:00
|
|
|
eshell-aliases-file (concat doom-local-dir ".eshell-aliases"))
|
2017-02-19 18:53:38 -05:00
|
|
|
|
|
|
|
:config
|
2017-02-23 00:06:12 -05:00
|
|
|
(set! :evil-state 'eshell-mode 'insert)
|
2017-02-19 18:53:38 -05:00
|
|
|
|
2017-09-27 12:42:24 +02:00
|
|
|
;; Keep track of open eshell buffers
|
|
|
|
(add-hook 'eshell-mode-hook #'+eshell|init)
|
|
|
|
(add-hook 'eshell-exit-hook #'+eshell|cleanup)
|
|
|
|
|
2017-05-12 12:07:28 +02:00
|
|
|
(after! em-term
|
|
|
|
;; Visual commands require a proper terminal. Eshell can't handle that, so it
|
|
|
|
;; delegates these commands to a term buffer.
|
|
|
|
(nconc eshell-visual-commands '("tmux" "htop" "bash" "zsh" "fish" "vim" "nvim"))
|
|
|
|
(setq eshell-visual-subcommands '(("git" "log" "l" "diff" "show"))))
|
2017-05-10 05:29:56 +02:00
|
|
|
|
2017-09-27 12:42:24 +02:00
|
|
|
(defun +eshell|init-keymap ()
|
|
|
|
"Setup eshell keybindings. This must be done in a hook because eshell-mode
|
2017-02-19 18:53:38 -05:00
|
|
|
redefines its keys every time `eshell-mode' is enabled."
|
2017-02-23 00:06:12 -05:00
|
|
|
(map! :map eshell-mode-map
|
2017-07-21 17:07:17 +02:00
|
|
|
:n "i" #'+eshell/evil-prepend-maybe
|
|
|
|
:n "I" #'+eshell/evil-prepend
|
|
|
|
:n "a" #'+eshell/evil-append-maybe
|
|
|
|
:n "A" #'+eshell/evil-append
|
|
|
|
:n "r" #'+eshell/evil-replace-maybe
|
|
|
|
:n "R" #'+eshell/evil-replace-state-maybe
|
|
|
|
:n "c" #'+eshell/evil-change
|
|
|
|
:n "C" #'+eshell/evil-change-line
|
2017-09-27 12:42:24 +02:00
|
|
|
:i [tab] #'eshell-pcomplete
|
2017-07-21 17:07:17 +02:00
|
|
|
:i "SPC" #'self-insert-command
|
2017-09-27 12:42:24 +02:00
|
|
|
:i "C-u" #'eshell-kill-input
|
2017-07-21 17:07:17 +02:00
|
|
|
:i "C-a" #'eshell-bol
|
|
|
|
:i "C-d" #'+eshell/quit-or-delete-char
|
|
|
|
:i "C-k" #'kill-line
|
|
|
|
:i "C-p" #'eshell-previous-input
|
|
|
|
:i "<up>" #'eshell-previous-input
|
2017-09-27 12:42:24 +02:00
|
|
|
:i "C-n" #'eshell-next-input
|
|
|
|
:i "<down>" #'eshell-next-input
|
2017-04-17 02:17:10 -04:00
|
|
|
:m "<return>" #'+eshell/evil-append
|
2017-09-27 12:42:24 +02:00
|
|
|
:n [remap evil-record-macro] #'eshell-life-is-too-much
|
2018-01-07 15:25:35 -05:00
|
|
|
[remap kill-this-buffer] #'eshell-life-is-too-much))
|
2017-09-27 12:42:24 +02:00
|
|
|
(add-hook 'eshell-mode-hook #'+eshell|init-keymap)
|
2017-02-19 18:53:38 -05:00
|
|
|
|
|
|
|
;; Aliases
|
|
|
|
(setq eshell-command-aliases-list
|
|
|
|
'(("q" "exit")
|
|
|
|
("l" "ls -1")
|
|
|
|
("ll" "ls -l")
|
|
|
|
("la" "ls -la")
|
|
|
|
("g" "hub")
|
2017-09-27 12:42:24 +02:00
|
|
|
("gs" "hub status --short ."))))
|
2017-02-19 18:53:38 -05:00
|
|
|
|