diff options
author | Case Duckworth | 2021-10-09 16:21:46 -0500 |
---|---|---|
committer | Case Duckworth | 2021-10-09 16:21:55 -0500 |
commit | 40b22bc70f62fda482e5354cebeebb4f2b732064 (patch) | |
tree | 94891b97e81ee908b0ee9a04f90174e1fc398691 | |
parent | Change back: Smartparens -> Paredit (diff) | |
download | emacs-40b22bc70f62fda482e5354cebeebb4f2b732064.tar.gz emacs-40b22bc70f62fda482e5354cebeebb4f2b732064.zip |
Add eshell/z
-rw-r--r-- | eshell.el | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/eshell.el b/eshell.el index c6078c2..a2ac33b 100644 --- a/eshell.el +++ b/eshell.el | |||
@@ -28,15 +28,32 @@ | |||
28 | 28 | ||
29 | ;;; Functions | 29 | ;;; Functions |
30 | 30 | ||
31 | ;; https://karthinks.com/software/jumping-directories-in-eshell/ | ||
32 | (defun eshell/z (&optional regexp) | ||
33 | "Navigate to a previously visited directory in eshell, or to | ||
34 | any directory proferred by `consult-dir'." | ||
35 | (let ((eshell-dirs (delete-dups | ||
36 | (mapcar 'abbreviate-file-name | ||
37 | (ring-elements eshell-last-dir-ring))))) | ||
38 | (cond | ||
39 | ((and (not regexp) (featurep 'consult-dir)) | ||
40 | (let* ((consult-dir--source-eshell `(:name "Eshell" | ||
41 | :narrow ?e | ||
42 | :category file | ||
43 | :face consult-file | ||
44 | :items ,eshell-dirs)) | ||
45 | (consult-dir-sources (cons consult-dir--source-eshell | ||
46 | consult-dir-sources))) | ||
47 | (eshell/cd (substring-no-properties | ||
48 | (consult-dir--pick "Switch directory: "))))) | ||
49 | (t (eshell/cd (if regexp (eshell-find-previous-directory regexp) | ||
50 | (completing-read "cd: " eshell-dirs))))))) | ||
51 | |||
31 | ;;; Extra eshell packages | 52 | ;;; Extra eshell packages |
32 | 53 | ||
33 | (setup (:straight esh-autosuggest) | 54 | (setup (:straight esh-autosuggest) |
34 | (:hook-into eshell-mode)) | 55 | (:hook-into eshell-mode)) |
35 | 56 | ||
36 | (setup (:straight esh-help) | ||
37 | (require 'esh-help) | ||
38 | (setq-local eldoc-documentation-function #'esh-help-eldoc-command)) | ||
39 | |||
40 | (setup (:straight eshell-syntax-highlighting) | 57 | (setup (:straight eshell-syntax-highlighting) |
41 | (eshell-syntax-highlighting-global-mode +1)) | 58 | (eshell-syntax-highlighting-global-mode +1)) |
42 | 59 | ||
@@ -53,3 +70,7 @@ | |||
53 | 70 | ||
54 | (provide 'eshellrc) | 71 | (provide 'eshellrc) |
55 | ;;; eshell.el ends here | 72 | ;;; eshell.el ends here |
73 | |||
74 | ;; Local Variables: | ||
75 | ;; flymake-inhibit: t | ||
76 | ;; End: | ||