diff --git a/kittens/url_hints/main.py b/kittens/url_hints/main.py index 0f2d1b9a4..aaed2076f 100644 --- a/kittens/url_hints/main.py +++ b/kittens/url_hints/main.py @@ -212,6 +212,8 @@ OPTIONS = partial('''\ default=default What program to use to open matched URLs. Defaults to the default URL open program for the operating system. +Use a value of - to paste the URL into the terminal window +instead. --regex @@ -239,4 +241,9 @@ def main(args): def handle_result(args, data, target_window_id, boss): program = data['program'] - boss.open_url(data['url'], None if program == 'default' else program) + if program == '-': + w = boss.window_id_map.get(target_window_id) + if w is not None: + w.paste(data['url']) + else: + boss.open_url(data['url'], None if program == 'default' else program) diff --git a/kitty/kitty.conf b/kitty/kitty.conf index 50e1b13d3..2dc00a0b2 100644 --- a/kitty/kitty.conf +++ b/kitty/kitty.conf @@ -432,9 +432,11 @@ map ctrl+shift+backspace restore_font_size map ctrl+shift+f11 toggle_fullscreen map ctrl+shift+u input_unicode_character map ctrl+shift+f2 edit_config_file -# Open a currently visible URL using the keyboard. The program used to open the URL is specified in open_url_with. -# You can customize how the URLs are detected and opened by specifying command line options to -# url_hints. For example: +# Open a currently visible URL using the keyboard. The program used to open the +# URL is specified in open_url_with. You can customize how the URLs are +# detected and opened by specifying command line options to url_hints. The +# special value of - for --program will cause the selected URL to be inserted +# into the terminal. For example: # map ctrl+shift+e run_kitten text url_hints --program firefox --regex "http://[^ ]+" map ctrl+shift+e run_kitten text url_hints # Open the kitty shell in a new window/tab/overlay/os_window to control kitty using commands.