From 4c636fdeca117c82f44f5897cec0166caa32aed8 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 4 Jun 2018 22:36:25 +0530 Subject: [PATCH] More conf docs --- docs/conf.py | 1 + kitty/conf/definition.py | 4 ++-- kitty/config_data.py | 39 ++++++++++++++++++++++++++++++++++++--- 3 files changed, 39 insertions(+), 5 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 868e1dba4..d1cca4941 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -373,6 +373,7 @@ def render_conf(conf_name, all_options): kitty_mod = 'kitty_mod' def render_group(group): + a('') a(group.short_text) heading_level = '+' if '.' in group.name else '^' a(heading_level * (len(group.short_text) + 20)) diff --git a/kitty/conf/definition.py b/kitty/conf/definition.py index 21e5ab79f..ea51ced68 100644 --- a/kitty/conf/definition.py +++ b/kitty/conf/definition.py @@ -136,7 +136,7 @@ def as_conf_file(all_options): def render_group(group, is_shortcut): nonlocal num_open_folds if is_shortcut or '.' not in group.name: - a('# ' + group.short_text + ' {{''{') + a('#: ' + group.short_text + ' {{''{') num_open_folds += 1 a('') if group.start_text: @@ -149,7 +149,7 @@ def as_conf_file(all_options): a(''), a(render_block(group.end_text)) is_subgroup = new_group_name.startswith(group.name + '.') if not is_subgroup and num_open_folds > 0: - a('# }}''}'), a('') + a('#: }}''}'), a('') num_open_folds -= 1 def handle_group(new_group, is_shortcut=False): diff --git a/kitty/config_data.py b/kitty/config_data.py index 6a9d747db..0f6e87205 100644 --- a/kitty/config_data.py +++ b/kitty/config_data.py @@ -2,7 +2,7 @@ # vim:fileencoding=utf-8 # License: GPL v3 Copyright: 2018, Kovid Goyal - +# Utils {{{ from gettext import gettext as _ from . import fast_data_types as defines @@ -15,7 +15,7 @@ from .layout import all_layouts from .rgb import color_as_int, color_as_sharp, color_from_int from .utils import log_error -# Utils {{{ + MINIMUM_FONT_SIZE = 4 @@ -47,6 +47,9 @@ def uniq(vals, result_type=list): seen = set() seen_add = seen.add return result_type(x for x in vals if x not in seen and not seen_add(x)) +# }}} + +# Groups {{{ all_options = {} @@ -118,6 +121,27 @@ You can also create shortcuts to go to specific tabs, with 1 being the first tab Just as with :code:`new_window` above, you can also pass the name of arbitrary commands to run when using new_tab and use :code:`new_tab_with_cwd`. +''')], + 'shortcuts.layout': [ + _('Layout management'), '', + _('''\ +You can also create shortcuts to switch to specific layouts:: + + map ctrl+alt+t goto_layout tall + map ctrl+alt+s goto_layout stack +''')], + 'shortcuts.fonts': [ + _('Font sizes'), _('''\ +You can change the font size for all top-level kitty windows at a time +or only the current one. +'''), _('''\ +To setup shortcuts for specific font sizes:: + + map kitty_mod+f6 change_font_size all 10.0 + +To setup shortcuts to change only the current window's font size:: + + map kitty_mod+f6 change_font_size current 10.0 ''')], }) # }}} @@ -707,12 +731,21 @@ k('next_tab', 'kitty_mod+right', 'next_tab', _('Next tab')) k('previous_tab', 'kitty_mod+left', 'previous_tab', _('Previous tab')) k('new_tab', 'kitty_mod+t', 'new_tab', _('New tab')) k('close_tab', 'kitty_mod+q', 'close_tab', _('Close tab')) -k('next_layout', 'kitty_mod+l', 'next_layout', _('Next layout')) k('move_tab_forward', 'kitty_mod+.', 'move_tab_forward', _('Move tab forward')) k('move_tab_backward', 'kitty_mod+,', 'move_tab_backward', _('Move tab backward')) k('set_tab_title', 'kitty_mod+alt+t', 'set_tab_title', _('Set tab title')) # }}} +g('shortcuts.layout') # {{{ +k('next_layout', 'kitty_mod+l', 'next_layout', _('Next layout')) +# }}} + + +g('shortcuts.fonts') # {{{ +k('increase_font_size', 'kitty_mod+equal', 'change_font_size all +2.0', _('Increase font size')) +k('decrease_font_size', 'kitty_mod+minus', 'change_font_size all -2.0', _('Decrease font size')) +k('reset_font_size', 'kitty_mod+backspace', 'change_font_size all 0', _('Reset font size')) +# }}} # }}} type_map = {o.name: o.option_type for o in all_options.values() if hasattr(o, 'option_type')}