diff --git a/CHANGELOG.develop b/CHANGELOG.develop index 2bdca2d97..f546c4c48 100644 --- a/CHANGELOG.develop +++ b/CHANGELOG.develop @@ -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) diff --git a/layers/+tools/shell/README.org b/layers/+tools/shell/README.org index 8c13d42d4..b66ec2fb5 100644 --- a/layers/+tools/shell/README.org +++ b/layers/+tools/shell/README.org @@ -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 | diff --git a/layers/+tools/shell/funcs.el b/layers/+tools/shell/funcs.el index 9f0ed355f..24820dd56 100644 --- a/layers/+tools/shell/funcs.el +++ b/layers/+tools/shell/funcs.el @@ -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 "") #'spacemacs/pcomplete-std-complete)) + (defun term-send-tab () "Send tab in term mode." (interactive) diff --git a/layers/+tools/shell/packages.el b/layers/+tools/shell/packages.el index 3e4ce15ad..1570063ee 100644 --- a/layers/+tools/shell/packages.el +++ b/layers/+tools/shell/packages.el @@ -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