Fix DYM and add aliases

Fixed the use-package! declaration for eshell-did-you-mean since it
needed a different mode in the :after than I thought.
I also put together a quick hack to try and fix an issue with
did-you-mean, but it doesn't seem to work reliably right now. More
testing required.

Also added two aliases, one `gg` for to open magit-status and one `ff`
as an additional alias to find-file that follows the Doom keybindings
better.
This commit is contained in:
Steven vanZyl 2020-04-28 16:54:34 -04:00
parent 85cf7a794b
commit a82d93630f
2 changed files with 23 additions and 8 deletions

View File

@ -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.

View File

@ -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"))