[shell] Add Eshell Ivy completion bindings

M-l calls spacemacs/ivy-eshell-history
TAB calls spacemacs/pcomplete-std-complete
This commit is contained in:
bb2020 2019-05-09 00:10:08 +03:00 committed by duianto
parent 953573ade5
commit e22cfadf1f
4 changed files with 29 additions and 3 deletions

View File

@ -2146,6 +2146,9 @@ Other:
- Moved =eshell-z-freq-dir-hash-table-file-name= into cache dir
(thanks to bb2020)
- Enabled ~TAB~ completion in =eshell= with =Helm= (thanks to bb2020)
- Added =eshell= =Ivy= completion bindings (thanks to bb2020):
- ~M-l~ =spacemacs/ivy-eshell-history=
- ~TAB~ =spacemacs/pcomplete-std-complete=
**** Shell Scripts
- Added new company-shell environment variable backend
(thanks to Alexander-Miller)

View File

@ -235,6 +235,6 @@ in the current buffer instead of a popup.
** Eshell
| Key binding | Description |
|--------------------+--------------------------------------------|
| ~SPC m H~ or ~M-l~ | shell commands history using a helm buffer |
| Key binding | Description |
|--------------------+---------------------------------------------------|
| ~SPC m H~ or ~M-l~ | shell commands history using a helm or ivy buffer |

View File

@ -174,6 +174,23 @@ is achieved by adding the relevant text properties."
(define-key eshell-mode-map
(kbd "M-l") 'spacemacs/helm-eshell-history))
(defun spacemacs/ivy-eshell-history ()
(interactive)
(counsel-esh-history)
(evil-insert-state))
(defun spacemacs/pcomplete-std-complete ()
(interactive)
(pcomplete-std-complete)
(evil-insert-state))
(defun spacemacs/init-ivy-eshell ()
"Initialize ivy-eshell."
(spacemacs/set-leader-keys-for-major-mode 'eshell-mode
"H" #'spacemacs/ivy-eshell-history)
(define-key eshell-mode-map (kbd "M-l") #'spacemacs/ivy-eshell-history)
(define-key eshell-mode-map (kbd "<tab>") #'spacemacs/pcomplete-std-complete))
(defun term-send-tab ()
"Send tab in term mode."
(interactive)

View File

@ -18,6 +18,7 @@
eshell-prompt-extras
eshell-z
helm
ivy
magit
multi-term
org
@ -151,6 +152,11 @@
(spacemacs/set-leader-keys-for-major-mode 'shell-mode
"H" 'spacemacs/helm-shell-history))))
(defun shell/pre-init-ivy ()
(spacemacs|use-package-add-hook ivy
:post-init
(add-hook 'eshell-mode-hook 'spacemacs/init-ivy-eshell)))
(defun shell/pre-init-magit ()
(spacemacs|use-package-add-hook magit
:post-init