Commit f91edb7906b1

Vincent Demeester <vincent@sbr.pm>
2024-12-05 15:33:04
tools/emacs: add eshell-atuin
Integrate eshell with atuin. This makes sharing shell history between eshell, zsh and all my hosts 🎉. Signed-off-by: Vincent Demeester <vincent@sbr.pm>
1 parent d756a76
Changed files (1)
tools
emacs
tools/emacs/config/config-shells.el
@@ -3,6 +3,9 @@
 ;;; Shell scripting
 ;;; Code:
 
+(defvar ISATUIN (executable-find "atuin")
+  "Whether atuin is available for shell/eshell history.")
+
 (use-package shell
   :commands (shell)
   :bind (("<f1>"      . shell)
@@ -128,6 +131,20 @@ any directory proferred by `consult-dir'."
 
   (add-hook 'eshell-mode-hook #'with-editor-export-editor))
 
+(use-package eshell-atuin
+  :when ISATUIN
+  :after eshell
+  ;; :bind* ( :map eshell-mode-map
+  ;;          ([remap eshell-previous-matching-input] . eshell-atuin-history))
+  :bind (("C-r" . eshell-atuin-history)
+	 ([remap eshell-list-history] . eshell-atuin-history))
+  :config
+  (eshell-atuin-mode)
+  (setopt eshell-atuin-filter-mode 'global
+          eshell-atuin-search-fields '(time duration command directory host)
+	  eshell-atuin-search-options '() ;; default --exit 0 ignores all the one imported… which is a shame
+          eshell-atuin-history-format "%-80c %-40i %>10t %h"))
+
 (use-package em-prompt
   :after eshell
   :config