Reorganize eshell config

This commit is contained in:
Case Duckworth 2021-09-06 12:51:48 -05:00
parent 3d12dea135
commit 3e7bb0cc18
2 changed files with 92 additions and 13 deletions

70
eshell.el Normal file
View File

@ -0,0 +1,70 @@
;;; eshell.el --- eshell-specific configuration -*- lexical-binding: t; -*-
;; Copyright (C) 2021 Case Duckworth
;; Author: Case Duckworth <acdw@acdw.net>
;; Keywords:
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;; Much like ~/.emacs.d/gnus.el, this is eshell-specific configuration that's
;; loaded whenever `eshell' is loaded.
;;; Code:
(require 'setup)
;;; Environment
(setenv "PAGER" "cat")
;;; Aliases
(dolist (definition '(("e" . "find-file $1")
("ff" . "find-file $1")
("emacs" . "find-file $1")
("ee" . "find-file-other-window $1")))
(eshell/alias (car definition) (cdr definition)))
;;; Functions
;;; Extra eshell packages
(setup (:straight esh-autosuggest)
(:hook-into eshell-mode))
(setup (:straight esh-help)
(require 'esh-help)
(setq-local eldoc-documentation-function #'esh-help-eldoc-command))
(setup (:straight eshell-syntax-highlighting)
(eshell-syntax-highlighting-global-mode +1))
(setup (:straight-if fish-completion
(executable-find "fish"))
(:autoload global-fish-completion-mode)
(global-fish-completion-mode +1))
;;; Miscellaneous
;; Fix modeline
(when (boundp 'simple-modeline--mode-line)
(setq mode-line-format '(:eval simple-modeline--mode-line)))
;;; Tell Emacs our customizations are loaded.
(defvar eshell-customizations-loaded t
"Whether eshell's customizations have been loaded yet.")
;;; eshell.el ends here

35
init.el
View File

@ -671,6 +671,9 @@ AKA, DO NOT USE THIS FUNCTION!!!"
kill-read-only-ok t
load-prefer-newer t
native-comp-async-report-warnings-errors nil
password-cache t
password-cache-expiry 3600 ; 5 minutes
read-extended-command-predicate ; emacs 28
set-mark-command-repeat-pop t)
(when (fboundp 'command-completion-default-include-p)
@ -832,33 +835,34 @@ AKA, DO NOT USE THIS FUNCTION!!!"
(setup (:straight eros)
(:hook-into emacs-lisp-mode))
(setup (:straight esh-autosuggest)
(:autoload esh-autosuggest-mode)
(:hook-into eshell-mode))
(setup eshell
(:also-load acdw-eshell
em-smart)
em-smart
em-tramp)
(:option eshell-aliases-file (acdw/dir "eshell/aliases" t)
eshell-destroy-buffer-when-process-dies t
eshell-directory-name (acdw/dir "eshell/" t)
eshell-error-if-no-glob t
eshell-hist-ignore-dups t
eshell-kill-on-exit nil
eshell-prefer-lisp-functions t ; I want to try using eshell
eshell-prefer-lisp-variables t ; as much as possible.
eshell-review-quick-commands nil
eshell-save-history-on-exit t
eshell-scroll-to-bottom-on-input 'all
eshell-smart-space-goes-to-end t
eshell-where-to-jump 'begin)
;; Make navigating amongst prompts easier
(:local-set outline-regexp eshell-prompt-regexp
page-delimiter eshell-prompt-regexp)
(:bind "C-d" #'eshell-quit-or-delete-char)
(:hook #'eshell-arg-hist-mode
(:hook #'eshell-arg-hist-mode
(defun eshell-mode@setup ()
;; Fix modeline
(when (boundp 'simple-modeline--mode-line)
(setq mode-line-format '(:eval simple-modeline--mode-line))))))
(unless (bound-and-true-p eshell-customizations-loaded)
(load (expand-file-name "eshell" user-emacs-directory))))))
(setup eww
(:option eww-search-prefix "https://duckduckgo.com/html?q="
@ -1833,7 +1837,12 @@ If used with a numeric prefix argument N, N backticks will be inserted."
(:global "M-%" #'vr/query-replace))
(setup (:straight-if vterm
(acdw/system :home)))
(acdw/system :home))
(:straight (eshell-vterm
:host github
:repo "iostapyshyn/eshell-vterm"))
(eshell-vterm-mode +1)
(defalias 'eshell/v 'eshell-exec-visual))
(setup w32
(:option w32-allow-system-shell t