mirror of
https://github.com/kovidgoyal/kitty.git
synced 2024-09-11 14:45:31 +03:00
Add some more default keybindings for the hints kitten
This commit is contained in:
parent
1779cdd353
commit
c95d1393cc
@ -32,7 +32,10 @@
|
||||
:sc_previous_tab: pass:quotes[`ctrl+shift+left`]
|
||||
:sc_previous_window: pass:quotes[`ctrl+shift+[`]
|
||||
:sc_restore_font_size: pass:quotes[`ctrl+shift+backspace`]
|
||||
:sc_run_simple_kitten_text_url_hints: pass:quotes[`ctrl+shift+e`]
|
||||
:sc_run_kitten_text_hints: pass:quotes[`ctrl+shift+e`]
|
||||
:sc_run_kitten_text_hints___type_line___program__: pass:quotes[`ctrl+shift+p → l`]
|
||||
:sc_run_kitten_text_hints___type_path: pass:quotes[`ctrl+shift+p → shift+f`]
|
||||
:sc_run_kitten_text_hints___type_path___program__: pass:quotes[`ctrl+shift+p → f`]
|
||||
:sc_scroll_end: pass:quotes[`ctrl+shift+end`]
|
||||
:sc_scroll_home: pass:quotes[`ctrl+shift+home`]
|
||||
:sc_scroll_line_down: pass:quotes[`ctrl+shift+down` or `ctrl+shift+j`]
|
||||
@ -69,7 +72,7 @@ link:#layouts[layouts] without needing to use an extra program like tmux
|
||||
* Can be link:remote-control.asciidoc[controlled from scripts or the shell prompt], even over SSH.
|
||||
|
||||
* Has a framework for _kittens_, small terminal programs that can be used to extend kitty's functionality.
|
||||
For example, they are used for link:#unicode-input[Unicode input] and link:#url-hints[URL hints].
|
||||
For example, they are used for link:#unicode-input[Unicode input] and link:#url-hints[Hints].
|
||||
|
||||
* Supports link:#startup-sessions[startup sessions] which allow you to specify the window/tab layout,
|
||||
working directories and programs to run on startup.
|
||||
@ -286,13 +289,23 @@ keys/tab to select the character from the displayed matches. You can also type
|
||||
a leading period and the index for the match if you dont like to use arrow
|
||||
keys.
|
||||
|
||||
== URL hints
|
||||
== Hints
|
||||
|
||||
kitty has a _hints mode_ to click URLs visible on the screen by using only the keyboard.
|
||||
Press {sc_run_simple_kitten_text_url_hints} to activate hints mode, as shown below.
|
||||
kitty has a _hints mode_ to select and act on arbitrary text snippets currently
|
||||
visible on the screen. For example, you can press {sc_run_kitten_text_hints}
|
||||
to choose any URL visible on the screen and then open it using your system
|
||||
browser.
|
||||
|
||||
image::hints_mode.png?raw=true[URL hints mode]
|
||||
|
||||
Similarly, you can press {sc_run_kitten_text_hints___type_path___program__} to
|
||||
select anything that looks like a path or filename and then insert it into the
|
||||
terminal, very useful for picking files from the output of a git or ls command and
|
||||
adding them to the command line for the next command.
|
||||
|
||||
The hints kitten is very powerful to see more detailed help on its various
|
||||
options and modes of operation, use: `kitty +kitten hints --help`.
|
||||
|
||||
== Miscellaneous features
|
||||
|
||||
* You can also hold down `ctrl+shift` and click on a URL to open it in a browser.
|
||||
|
@ -190,6 +190,10 @@ def run(args, text):
|
||||
'|'.join(args.url_prefixes.split(',')), url_delimiters
|
||||
)
|
||||
finditer = partial(find_urls, re.compile(url_pat))
|
||||
elif args.type == 'path':
|
||||
finditer = partial(regex_finditer, re.compile(r'(?:\S*/\S+)|(?:\S+[.][a-zA-Z0-9]{2,5})'))
|
||||
elif args.type == 'line':
|
||||
finditer = partial(regex_finditer, re.compile(r'(?m)^\s*(.+)\s*$'))
|
||||
else:
|
||||
finditer = partial(regex_finditer, re.compile(args.regex))
|
||||
lines = []
|
||||
@ -216,7 +220,7 @@ def run(args, text):
|
||||
|
||||
--type
|
||||
default=url
|
||||
choices=url,regex
|
||||
choices=url,regex,path,line
|
||||
The type of text to search for.
|
||||
|
||||
|
||||
|
@ -428,19 +428,34 @@ map ctrl+shift+backspace restore_font_size
|
||||
# map ctrl+shift+f7 set_font_size 20.5
|
||||
# }}}
|
||||
|
||||
# Select and act on visible text {{{
|
||||
# Use the hints kitten to select text and either pass it to an external program or
|
||||
# insert it into the terminal or copy it to the clipboard.
|
||||
#
|
||||
# Open a currently visible URL using the keyboard. The program used to open the
|
||||
# URL is specified in open_url_with.
|
||||
map ctrl+shift+e run_kitten text hints
|
||||
|
||||
# Select a path/filename and insert it into the terminal. Useful, for instance to
|
||||
# run git commands on a filename output from a previous git command.
|
||||
map ctrl+shift+p>f run_kitten text hints --type path --program -
|
||||
|
||||
# Select a path/filename and open it with the default open program.
|
||||
map ctrl+shift+p>shift+f run_kitten text hints --type path
|
||||
|
||||
# Select a line of text and insert it into the terminal. Use for the
|
||||
# output of things like: ls -1
|
||||
map ctrl+shift+p>l run_kitten text hints --type line --program -
|
||||
|
||||
# The hints kitten has many more modes of operation that you can map to different
|
||||
# shortcuts. For a full description run: kitty +kitten hints --help
|
||||
# }}}
|
||||
|
||||
# Miscellaneous {{{
|
||||
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 hints. The
|
||||
# special value of - for --program will cause the selected URL to be inserted
|
||||
# into the terminal. For example, to select words and insert them into the terminal:
|
||||
# map ctrl+shift+e run_kitten text hints --program - --type regex --regex \w+
|
||||
#
|
||||
# Use kitty +kitten hints --help to see the full help for the hints kitten.
|
||||
map ctrl+shift+e run_kitten text hints
|
||||
You can customize how the URLs are
|
||||
# Open the kitty shell in a new window/tab/overlay/os_window to control kitty using commands.
|
||||
map ctrl+shift+escape kitty_shell window
|
||||
|
||||
|
@ -16,8 +16,8 @@
|
||||
for line in open('kitty/kitty.conf'):
|
||||
if line.startswith('map '):
|
||||
_, sc, name = line.split(maxsplit=2)
|
||||
name = name.rstrip().replace(' ', '_')
|
||||
defns[name].append('`' + sc + '`')
|
||||
name = name.rstrip().replace(' ', '_').replace('-', '_')
|
||||
defns[name].append('`' + sc.replace('>', ' → ') + '`')
|
||||
|
||||
defns = [
|
||||
':sc_{}: pass:quotes[{}]'.format(name, ' or '.join(defns[name]))
|
||||
|
Loading…
Reference in New Issue
Block a user