From f1854bb4f66f1130ad4b7965c5f306d69a725929 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Mon, 3 Feb 2025 22:47:11 -0800 Subject: [PATCH] pop-os: Add history filter to Atuin --- oni/home/config/pop-os.scm | 4 +++- oni/home/services/zsh.scm | 19 +++++++++++++++---- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/oni/home/config/pop-os.scm b/oni/home/config/pop-os.scm index 853bb5b..7d9f7be 100644 --- a/oni/home/config/pop-os.scm +++ b/oni/home/config/pop-os.scm @@ -135,7 +135,9 @@ (service home-zsh-atuin-service-type (home-zsh-atuin-configuration (inline-height 20) - (filter-mode 'directory))) + (filter-mode 'directory) + (history-filter + '("^ +")))) (service home-stumpwm-service-type (home-stumpwm-configuration diff --git a/oni/home/services/zsh.scm b/oni/home/services/zsh.scm index 4de41cc..373ea6e 100644 --- a/oni/home/services/zsh.scm +++ b/oni/home/services/zsh.scm @@ -143,12 +143,18 @@ (default-value (home-zsh-autopair-configuration)) (description "Install and configure zsh-autopair."))) +(define (serialize-field-name field) + (string-replace-substring (symbol->string field) "-" "_")) + (define (serialize-integer field value) - (format #f "~a = ~a~%" (string-replace-substring (symbol->string field) "-" "_") value)) + (format #f "~a = ~a~%" (serialize-field-name field) value)) (define (serialize-filter-mode field value) - (format #f "~a = ~s~%" (string-replace-substring (symbol->string field) "-" "_") - (symbol->string value))) + (format #f "~a = ~s~%" (serialize-field-name field) (symbol->string value))) + +(define (serialize-list-of-strings field value) + (format #f "~a = ~a~%" (serialize-field-name field) + (string-append "[" (string-join (map (λ (v) (format #f "~s" v)) value) ",") "]"))) (define (filter-mode? value) (memq value '(global host session directory workspace))) @@ -162,7 +168,12 @@ "Set the maximum number of lines Atuin’s interface should take up.") (filter-mode (filter-mode 'global) - "The default filter to use when searching")) + "The default filter to use when searching") + (history-filter + (list-of-strings '()) + "The history filter allows you to exclude commands from history tracking - maybe +you want to keep ALL of your curl commands totally out of your shell history, or +maybe just some matching a pattern.")) (define (add-zsh-atuin config) (home-zsh-extension