Closed ilyagr closed 1 year ago
Here's another piece of debug info. I'm not sure whether the '\b' at the end needs to be '\b' or not.
🐟 tmux showenv -g FINGERS_PATTERNS
FINGERS_PATTERNS=((^|^\.|[[:space:]]|[[:space:]]\.|[[:space:]]\.\.|^\.\.)[[:alnum:]~_-]*/[][[:alnum:]_.#$%&+=/@-]+)|([[:digit:]]{4,})|([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})|([0-9a-f]{7,128})|((https?://|git@|git://|ssh://|ftp://|file:///)[[:alnum:]?=%/_.:,;~@!#$&()*+-]*)|([[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3})|(0x[0-9a-fA-F]+)|(deployment.app|binding|componentstatuse|configmap|endpoint|event|limitrange|namespace|node|persistentvolumeclaim|persistentvolume|pod|podtemplate|replicationcontroller|resourcequota|secret|serviceaccount|service|mutatingwebhookconfiguration.admissionregistration.k8s.io|validatingwebhookconfiguration.admissionregistration.k8s.io|customresourcedefinition.apiextension.k8s.io|apiservice.apiregistration.k8s.io|controllerrevision.apps|daemonset.apps|deployment.apps|replicaset.apps|statefulset.apps|tokenreview.authentication.k8s.io|localsubjectaccessreview.authorization.k8s.io|selfsubjectaccessreviews.authorization.k8s.io|selfsubjectrulesreview.authorization.k8s.io|subjectaccessreview.authorization.k8s.io|horizontalpodautoscaler.autoscaling|cronjob.batch|job.batch|certificatesigningrequest.certificates.k8s.io|events.events.k8s.io|daemonset.extensions|deployment.extensions|ingress.extensions|networkpolicies.extensions|podsecuritypolicies.extensions|replicaset.extensions|networkpolicie.networking.k8s.io|poddisruptionbudget.policy|clusterrolebinding.rbac.authorization.k8s.io|clusterrole.rbac.authorization.k8s.io|rolebinding.rbac.authorization.k8s.io|role.rbac.authorization.k8s.io|storageclasse.storage.k8s.io)[[:alnum:]_#$%&+=/@-]+|\b([k-z]{5,}|[K-Z]{5,}|[0-9a-f]{5,})\b|\b([k-z]{5,}|[K-Z]{5,}|[0-9a-f]{5,})\b
This is kind of hard to read, but the end of the line is
\b([k-z]{5,}|[K-Z]{5,}|[0-9a-f]{5,})\b|\b([k-z]{5,}|[K-Z]{5,}|[0-9a-f]{5,})\b
I'm not sure why it's repeated twice.
I've figured out the problem. Turns out, tmux-fingers
uses gawk
regular expressions as opposed to grep -E
regular expressions. While both are called "Extended Regular Expressions", they are different. In gawk, \b
means backspace and \<
& \>
are word boundaries. In grep -E
, \b
is a word boundary while \<
and >
also work.
TIL. I'll file a PR for the documentation bug part of it.
TLDR: the following works
set -g @fingers-pattern-0 '\<([k-z]{5,}|[K-Z]{5,}|[0-9a-f]{5,})\>'
I'd like to capture hashes from the output of a VCS I use. So, I put the following in my
tmux.conf
:However, it doesn't work as I expect. Let's say I have the following text in my terminal (sorry, the example is a bit messy, this was after some grep-ing):
If I turn on fingers-mode, the strings
e5e1f1
andSLMXST
are not highlighted. Instead, '2022' is:Meanwhile,
grep
works correctly (the fact that 'support' is highlighted is undesired, but it correctly matches the regex; the first line of the output is from my shell prompt):After a bit of thought, ~I think a likely explanation is that the unicode symbols mess up the counts somewhere inside
tmux-fingers.sh
~ (update: no, it's something config-related. Just the stringSLMXST ilyagr@ 2022-10-16 12:21 -07 e5e1f1
behaves the same). In any case, help is appreciated.I am using the latest version of tmux-fingers (commit
2e08de2
) on Debian stable (bookworm) Linux.