Merge branch 'def-conf-shortcuts' of https://github.com/page-down/kitty

This commit is contained in:
Kovid Goyal 2021-11-15 17:15:44 +05:30
commit cb2a99bd0e
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
3 changed files with 22 additions and 20 deletions

View File

@ -286,13 +286,13 @@ class Mapping:
def key_text(self) -> str: def key_text(self) -> str:
return '' return ''
def as_conf(self, commented: bool = False, level: int = 0) -> List[str]: def as_conf(self, commented: bool = False, level: int = 0, action_group: List['Mapping'] = []) -> List[str]:
ans: List[str] = [] ans: List[str] = []
if self.documented:
a = ans.append a = ans.append
if self.add_to_default: for sc in [self] + action_group:
a(self.setting_name + ' ' + self.parseable_text) if sc.documented and sc.add_to_default:
if self.long_text: a(sc.setting_name + ' ' + sc.parseable_text)
if self.documented and self.long_text:
a(''), a(render_block(self.long_text.strip())), a('') a(''), a(render_block(self.long_text.strip())), a('')
return ans return ans
@ -474,6 +474,8 @@ class Group:
for item in self.iter_with_coalesced_options(): for item in self.iter_with_coalesced_options():
if isinstance(item, Option): if isinstance(item, Option):
lines = item.as_conf(option_group=self.coalesced_iterator_data.option_group_for_option(item)) lines = item.as_conf(option_group=self.coalesced_iterator_data.option_group_for_option(item))
elif isinstance(item, Mapping):
lines = item.as_conf(commented, level + 1, action_group=self.coalesced_iterator_data.action_group_for_action(item))
else: else:
lines = item.as_conf(commented, level + 1) lines = item.as_conf(commented, level + 1)
ans.extend(lines) ans.extend(lines)

View File

@ -411,7 +411,7 @@ copy to a private kitty buffer instead. Map a shortcut with the
:code:`paste_from_buffer` action to paste from this private buffer. :code:`paste_from_buffer` action to paste from this private buffer.
For example:: For example::
map cmd+shift+v paste_from_buffer a1 map shift+cmd+v paste_from_buffer a1
Note that copying to the clipboard is a security risk, as all programs, Note that copying to the clipboard is a security risk, as all programs,
including websites open in your browser can read the contents of the including websites open in your browser can read the contents of the
@ -596,7 +596,7 @@ mma('Start selecting text even when grabbed',
) )
mma('Start selecting text in a rectangle even when grabbed', mma('Start selecting text in a rectangle even when grabbed',
'start_rectangle_selection_grabbed shift+ctrl+alt+left press ungrabbed,grabbed mouse_selection rectangle', 'start_rectangle_selection_grabbed ctrl+shift+alt+left press ungrabbed,grabbed mouse_selection rectangle',
) )
mma('Select a word even when grabbed', mma('Select a word even when grabbed',
@ -609,7 +609,7 @@ mma('Select a line even when grabbed',
) )
mma('Select line from point even when grabbed', mma('Select line from point even when grabbed',
'select_line_from_point_grabbed shift+ctrl+alt+left triplepress ungrabbed,grabbed mouse_selection line_from_point', 'select_line_from_point_grabbed ctrl+shift+alt+left triplepress ungrabbed,grabbed mouse_selection line_from_point',
long_text='Select from the clicked point to the end of the line' long_text='Select from the clicked point to the end of the line'
) )
@ -2941,7 +2941,7 @@ map('Scroll line up',
'scroll_line_up kitty_mod+k scroll_line_up', 'scroll_line_up kitty_mod+k scroll_line_up',
) )
map('Scroll line up', map('Scroll line up',
'scroll_line_up alt+cmd+page_up scroll_line_up', 'scroll_line_up opt+cmd+page_up scroll_line_up',
only="macos", only="macos",
) )
map('Scroll line up', map('Scroll line up',
@ -2956,7 +2956,7 @@ map('Scroll line down',
'scroll_line_down kitty_mod+j scroll_line_down', 'scroll_line_down kitty_mod+j scroll_line_down',
) )
map('Scroll line down', map('Scroll line down',
'scroll_line_down alt+cmd+page_down scroll_line_down', 'scroll_line_down opt+cmd+page_down scroll_line_down',
only="macos", only="macos",
) )
map('Scroll line down', map('Scroll line down',
@ -3227,7 +3227,7 @@ map('Previous tab',
only="macos", only="macos",
) )
map('Previous tab', map('Previous tab',
'previous_tab shift+ctrl+tab previous_tab', 'previous_tab ctrl+shift+tab previous_tab',
) )
map('New tab', map('New tab',
@ -3332,7 +3332,7 @@ map('Increase font size',
only="macos", only="macos",
) )
map('Increase font size', map('Increase font size',
'increase_font_size cmd+shift+equal change_font_size all +2.0', 'increase_font_size shift+cmd+equal change_font_size all +2.0',
only="macos", only="macos",
) )
@ -3347,7 +3347,7 @@ map('Decrease font size',
only="macos", only="macos",
) )
map('Decrease font size', map('Decrease font size',
'decrease_font_size cmd+shift+minus change_font_size all -2.0', 'decrease_font_size shift+cmd+minus change_font_size all -2.0',
only="macos", only="macos",
) )
@ -3453,7 +3453,7 @@ map('Unicode input',
'input_unicode_character kitty_mod+u kitten unicode_input', 'input_unicode_character kitty_mod+u kitten unicode_input',
) )
map('Unicode input', map('Unicode input',
'input_unicode_character cmd+ctrl+space kitten unicode_input', 'input_unicode_character ctrl+cmd+space kitten unicode_input',
only="macos", only="macos",
) )
@ -3523,7 +3523,7 @@ screen, for example, for ZSH add the following to :file:`~/.zshrc`:
) )
map('Reset the terminal', map('Reset the terminal',
'reset_terminal cmd+option+r clear_terminal reset active', 'reset_terminal opt+cmd+r clear_terminal reset active',
only="macos", only="macos",
) )
@ -3543,7 +3543,7 @@ the new conf settings *replace* the old ones.
) )
map('Reload kitty.conf', map('Reload kitty.conf',
'reload_config_file cmd+control+, load_config_file', 'reload_config_file ctrl+cmd+, load_config_file',
only='macos' only='macos'
) )
@ -3556,7 +3556,7 @@ its host environment. Useful for debugging issues.
) )
map('Debug kitty configuration', map('Debug kitty configuration',
'debug_config cmd+option+, debug_config', 'debug_config opt+cmd+, debug_config',
only='macos' only='macos'
) )

View File

@ -34,7 +34,7 @@ SequenceMap = Dict[SingleKey, SubSequenceMap]
MINIMUM_FONT_SIZE = 4 MINIMUM_FONT_SIZE = 4
default_tab_separator = '' default_tab_separator = ''
mod_map = {'CTRL': 'CONTROL', 'CMD': 'SUPER', '': 'SUPER', mod_map = {'CTRL': 'CONTROL', 'CMD': 'SUPER', '': 'SUPER',
'': 'ALT', 'OPTION': 'ALT', 'KITTY_MOD': 'KITTY'} '': 'ALT', 'OPTION': 'ALT', 'OPT': 'ALT', 'KITTY_MOD': 'KITTY'}
character_key_name_aliases_with_ascii_lowercase: Dict[str, str] = character_key_name_aliases.copy() character_key_name_aliases_with_ascii_lowercase: Dict[str, str] = character_key_name_aliases.copy()
for x in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ': for x in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ':
character_key_name_aliases_with_ascii_lowercase[x] = x.lower() character_key_name_aliases_with_ascii_lowercase[x] = x.lower()