diff --git a/docs/changelog.rst b/docs/changelog.rst index a0185508e..91e20d62e 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -19,9 +19,12 @@ Changelog - ssh kitten: Support all SSH options. It can now be aliased directly to ssh for convenience. (:pull:`591`) -- kitty icat: Add :option:`kitty +kitten icat --print-window-size` to easily +- icat kitten: Add :option:`kitty +kitten icat --print-window-size` to easily detect the window size in pixels from scripting languages (:iss:`581`) +- hints kitten: Allow selecting hashes from the terminal useful for git + commits. (:pull:`604`) + - Allow specifying initial window size in number of cells in addition to pixels (:iss:`436`) diff --git a/kittens/hints/main.py b/kittens/hints/main.py index 752de87fc..880c4639a 100644 --- a/kittens/hints/main.py +++ b/kittens/hints/main.py @@ -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 == 'hash': + pattern = '[0-9a-f]{7,128}' 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,hash,word The type of text to search for. diff --git a/kitty/kitty.conf b/kitty/kitty.conf index fb3a104b0..5756d0f41 100644 --- a/kitty/kitty.conf +++ b/kitty/kitty.conf @@ -490,6 +490,10 @@ map kitty_mod+e kitten hints # run git commands on a filename output from a previous git command. map kitty_mod+p>f kitten hints --type path --program - +# Select something that looks like a hash and insert it into the terminal. +# Useful with git, which uses sha1 hashes to identify commits +map kitty_mod+p>h kitten hints --type hash --program - + # Select a path/filename and open it with the default open program. map kitty_mod+p>shift+f kitten hints --type path