eshell: replace company w/ fish/bash powered pcomplete

This commit is contained in:
Henrik Lissner 2020-04-14 15:33:19 -04:00
parent 9abc10c78f
commit 661fa18af0
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
2 changed files with 17 additions and 12 deletions

View file

@ -135,8 +135,6 @@ You should use `set-eshell-alias!' to change this.")
:ni "C-j" #'eshell-next-matching-input-from-input
:ni "C-k" #'eshell-previous-matching-input-from-input
:ig "C-d" #'+eshell/quit-or-delete-char
"TAB" #'+eshell/pcomplete
[tab] #'+eshell/pcomplete
"C-s" #'+eshell/search-history
;; Emacs bindings
"C-e" #'end-of-line
@ -154,16 +152,7 @@ You should use `set-eshell-alias!' to change this.")
[remap doom/backward-kill-to-bol-and-indent] #'eshell-kill-input
[remap evil-delete-back-to-indentation] #'eshell-kill-input
[remap evil-window-split] #'+eshell/split-below
[remap evil-window-vsplit] #'+eshell/split-right)))
(add-hook! 'eshell-mode-hook
(defun +eshell-init-company-h ()
(when (featurep! :completion company)
(company-mode +1)
(setq-local company-idle-delay nil)
(setq-local company-backends '(company-pcomplete))
(setq-local company-frontends (cons 'company-tng-frontend company-frontends))
(when (bound-and-true-p evil-local-mode)
(evil-normalize-keymaps))))))
[remap evil-window-vsplit] #'+eshell/split-right))))
(use-package! eshell-up
@ -182,3 +171,15 @@ You should use `set-eshell-alias!' to change this.")
(use-package! esh-help
:after eshell
:config (setup-esh-help-eldoc))
(use-package! fish-completion
:hook (eshell-mode . fish-completion-mode)
:init (setq fish-completion-fallback-on-bash-p t)
:config
;; HACK Even with `fish-completion-fallback-on-bash-p' non-nil, fish must be
;; installed for bash completion to work. How frustrating. This way we
;; can at least get bash completion whether or not fish is present.
(defadvice! +eshell--fallback-to-bash-a (&rest _)
:before-while #'fish-completion--list-completions-with-desc
(executable-find "fish")))

View file

@ -5,3 +5,7 @@
(package! eshell-z :pin "337cb241e1")
(package! shrink-path :pin "c14882c859")
(package! esh-help :pin "417673ed18")
(when (featurep! :completion company)
(package! fish-completion :pin "1038488181")
(package! bash-completion :pin "96ce14af96"))