Add support for sha1 hashes to the hint kitten

This is specifically intended for git commit hashes, so it allows for
hashes as short as 7 characters (git's default length for abbreviated
hashes) up to the full 40 characters
This commit is contained in:
Robert Ricci
2018-06-04 14:25:38 -06:00
parent c9818e7bb1
commit 093921cb9a
2 changed files with 8 additions and 2 deletions

View File

@@ -244,6 +244,8 @@ def functions_for(args):
post_processors.extend((brackets, quotes))
elif args.type == 'line':
pattern = '(?m)^\\s*(.+)[\\s\0]*$'
elif args.type == 'sha1':
pattern = '[0-9a-f]{7,40}'
elif args.type == 'word':
chars = args.word_characters
if chars is None:
@@ -313,7 +315,7 @@ terminal window instead. A value of :file:`@` will copy the match to the clipboa
--type
default=url
choices=url,regex,path,line,word
choices=url,regex,path,line,sha1,word
The type of text to search for.
@@ -331,7 +333,7 @@ Comma separated list of recognized URL prefixes.
--word-characters
Characters to consider as part of a word. In addition, all characters marked as
Csha1,haracters to consider as part of a word. In addition, all characters marked as
alpha-numeric in the unicode database will be considered as word characters.
Defaults to the select_by_word_characters setting from kitty.conf.