From 0ea17e1f6835123b099b379f5ca9a714a98edad9 Mon Sep 17 00:00:00 2001 From: technofab Date: Tue, 10 Jun 2025 15:56:25 +0200 Subject: [PATCH] chore(patterns): add nix-shas --- src/textbuf/regexes.rs | 3 ++- tmux-copyrat.tmux | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/textbuf/regexes.rs b/src/textbuf/regexes.rs index eef75b8..20428b5 100644 --- a/src/textbuf/regexes.rs +++ b/src/textbuf/regexes.rs @@ -11,7 +11,7 @@ pub(super) const EXCLUDE_PATTERNS: [(&str, &str); 1] = /// /// The email address was obtained at https://www.regular-expressions.info/email.html. /// Some others were obtained from Ferran Basora, the rest is by me. -pub(super) const PATTERNS: [(&str, &str); 21] = [ +pub(super) const PATTERNS: [(&str, &str); 22] = [ ("markdown-url", r"\[[^]]*\]\(([^)]+)\)"), ( "url", @@ -48,6 +48,7 @@ pub(super) const PATTERNS: [(&str, &str); 21] = [ "command-line-args", r#"(?:--[a-z][0-9a-z\-_]+|-[a-z])(?: |=)([^-\s\n]\S+)"#, ), + ("nix-shas", r#"((sha256|sha512)-[a-zA-Z0-9+/=]{44})"#), ]; /// Type-safe string Pattern Name (newtype). diff --git a/tmux-copyrat.tmux b/tmux-copyrat.tmux index 189c8a0..3a7765e 100755 --- a/tmux-copyrat.tmux +++ b/tmux-copyrat.tmux @@ -82,6 +82,8 @@ setup_pattern_binding "p" "--pattern-name path" setup_pattern_binding "P" "--pattern-name pointer-address" # prefix + t + q searches for strings inside single|double|backticks setup_pattern_binding "q" "-x quoted-single -x quoted-double -x quoted-backtick" +# prefix + t + s searches for nix shas +setup_pattern_binding "s" "--pattern-name nix-shas" # prefix + t + u searches for URLs setup_pattern_binding "u" "--pattern-name url" # prefix + t + U searches for UUIDs