Allow the URL hints kitten to insert the selected URL into the terminal

This commit is contained in:
Kovid Goyal 2018-04-11 13:22:07 +05:30
parent 2cf8c6aea7
commit 75b5130d96
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 13 additions and 4 deletions

View File

@ -212,6 +212,8 @@ OPTIONS = partial('''\
default=default default=default
What program to use to open matched URLs. Defaults What program to use to open matched URLs. Defaults
to the default URL open program for the operating system. to the default URL open program for the operating system.
Use a value of - to paste the URL into the terminal window
instead.
--regex --regex
@ -239,4 +241,9 @@ def main(args):
def handle_result(args, data, target_window_id, boss): def handle_result(args, data, target_window_id, boss):
program = data['program'] 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)

View File

@ -432,9 +432,11 @@ map ctrl+shift+backspace restore_font_size
map ctrl+shift+f11 toggle_fullscreen map ctrl+shift+f11 toggle_fullscreen
map ctrl+shift+u input_unicode_character map ctrl+shift+u input_unicode_character
map ctrl+shift+f2 edit_config_file 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. # Open a currently visible URL using the keyboard. The program used to open the
# You can customize how the URLs are detected and opened by specifying command line options to # URL is specified in open_url_with. You can customize how the URLs are
# url_hints. For example: # 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 --program firefox --regex "http://[^ ]+"
map ctrl+shift+e run_kitten text url_hints 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. # Open the kitty shell in a new window/tab/overlay/os_window to control kitty using commands.