diff --git a/modules/term/eshell/README.org b/modules/term/eshell/README.org index de43e43f8..ad3c5878b 100644 --- a/modules/term/eshell/README.org +++ b/modules/term/eshell/README.org @@ -8,6 +8,7 @@ - [[#maintainers][Maintainers]] - [[#module-flags][Module Flags]] - [[#plugins][Plugins]] + - [[#hacks][Hacks]] - [[#prerequisites][Prerequisites]] - [[#features][Features]] - [[#configuration][Configuration]] @@ -37,6 +38,12 @@ company= is enabled. + [[https://gitlab.com/ambrevar/emacs-fish-completion][fish-completion]] + [[https://github.com/szermatt/emacs-bash-completion][bash-completion]] +** Hacks ++ Even with =fish-completion-fallback-on-bash-p= non-nil, fish must be installed + for bash completion to work. Workaround in =config.el=. ++ =eshell-did-you-mean= does not work on first invocation, so we manually invoke + it once. + * Prerequisites [[https://fishshell.com/][=fish= shell]] for completions, falling back to [[https://www.gnu.org/software/bash/][=bash= shell]] if =fish= is not found. If neither shell is found, completions may not be available. diff --git a/modules/term/eshell/config.el b/modules/term/eshell/config.el index d58ce2bd6..b84b9016c 100644 --- a/modules/term/eshell/config.el +++ b/modules/term/eshell/config.el @@ -12,6 +12,10 @@ "Where to store eshell configuration files, as opposed to `eshell-directory-name', which is where Doom will store temporary/data files.") +(defvar eshell-directory-name (concat doom-etc-dir "eshell") + "Where to store temporary/data files, as opposed to `eshell-config-dir', +which is where Doom will store eshell configuration files.") + (defvar +eshell-enable-new-shell-on-split t "If non-nil, spawn a new eshell session after splitting from an eshell buffer.") @@ -22,11 +26,13 @@ buffer.") (defvar +eshell-aliases '(("q" "exit") ; built-in ("f" "find-file $1") + ("ff" "find-file $1") ("d" "dired $1") ("bd" "eshell-up $1") ("rg" "rg --color=always $*") ("l" "ls -lh $*") ("ll" "ls -lah $*") + ("gg" "magit-status") ("clear" "clear-scrollback")) ; more sensible than default "An alist of default eshell aliases, meant to emulate useful shell utilities, like fasd and bd. Note that you may overwrite these in your @@ -35,15 +41,11 @@ to define your aliases. You should use `set-eshell-alias!' to change this.") -;; -(defvar eshell-directory-name (concat doom-etc-dir "eshell")) - ;; These files are exceptions, because they may contain configuration (defvar eshell-aliases-file (concat +eshell-config-dir "aliases")) (defvar eshell-rc-script (concat +eshell-config-dir "profile")) (defvar eshell-login-script (concat +eshell-config-dir "login")) - (defvar +eshell--default-aliases nil) @@ -188,8 +190,14 @@ You should use `set-eshell-alias!' to change this.") :before-while #'fish-completion--list-completions-with-desc (executable-find "fish"))) -;; Active eshell-did-you-mean using its setup function which provides -;; its own hooks. + +;; Activate eshell-did-you-mean using its setup function (lazily) (use-package! eshell-did-you-mean - :after eshell - :config (eshell-did-you-mean-setup)) + :after esh-mode ; Specifically esh-mode, not eshell + :config + (eshell-did-you-mean-setup) + ;; HACK There is a known issue with `eshell-did-you-mean' where it does not + ;; work on first invocation, so we invoke it once manually by setting + ;; the last command and then calling the output filter. + (setq eshell-last-command-name "catt") + (eshell-did-you-mean-output-filter "catt: command not found"))