readme: add filter mode

This commit is contained in:
Pavel Korytov 2024-05-20 00:31:41 +03:00
parent 1e0e2503b5
commit 256982e335
2 changed files with 22 additions and 4 deletions

View file

@ -60,6 +60,19 @@ Enable =eshell-atuin-mode= to turn on storing eshell commands in =atuin=.
Run =eshell-atuin-history= inside an =eshell= buffer to browse the saved history. Accepting the completion will insert the command.
** Filter mode
=atuin= supports 4 [[https://docs.atuin.sh/configuration/config/#filter_mode][filter modes]]: global (default), host, session, directory. Default filter mode for =eshell-atuin= can be set as follows:
#+begin_src emacs-lisp
(setq eshell-atuin-filter-mode 'global)
#+end_src
In order to switch the mode at runtime, run =M-x eshell-atuin-history= with the prefix argument:
- =C-u 0 M-x eshell-atuin-history= for =global=
- =C-u 1 M-x eshell-atuin-history= for =host=
- =C-u 2 M-x eshell-atuin-history= for =session=
- =C-u 3 M-x eshell-atuin-history= for =directory=
* Implementation notes
I may have overengineered the package a bit to scale on lots of records.

View file

@ -132,10 +132,15 @@ include here. Some examples:
:group 'eshell-atuin
:type '(choice
(const nil :tag "Use default filter")
(const 'global :tag "All hosts, all sessions, all directories")
(const 'host :tag "History just from this host")
(const 'session :tag "History just from this session")
(const 'directory :tag "History just from this directory")))
(const global :tag "All hosts, all sessions, all directories")
(const host :tag "History just from this host")
(const session :tag "History just from this session")
(const directory :tag "History just from this directory"))
:set
(lambda (sym value)
(set-default sym value)
(when (fboundp #'eshell-atuin--history-rotate-cache)
(eshell-atuin--history-rotate-cache))))
(defvar-local eshell-atuin--history-id nil
"Atuin ID of the current eshell command.")