diff --git a/docs/basic.rst b/docs/basic.rst index e7b5acab4..9a1982726 100644 --- a/docs/basic.rst +++ b/docs/basic.rst @@ -116,6 +116,7 @@ Toggle maximized :sc:`toggle_maximized` Input unicode character :sc:`input_unicode_character` (also :kbd:`^+⌘+space` on macOS) Click URL using the keyboard :sc:`open_url` Reset the terminal :sc:`reset_terminal` +Reload :file:`kitty.conf` :sc:`reload_config_file` Debug :file:`kitty.conf` :sc:`debug_config` Pass current selection to program :sc:`pass_selection_to_program` Edit |kitty| config file :sc:`edit_config_file` diff --git a/docs/conf.rst b/docs/conf.rst index 6fba0c3be..960507568 100644 --- a/docs/conf.rst +++ b/docs/conf.rst @@ -5,13 +5,14 @@ Configuring kitty .. highlight:: conf -|kitty| is highly customizable, everything from keyboard shortcuts, to painting -frames-per-second. See below for an overview of all customization +|kitty| is highly customizable, everything from keyboard shortcuts, to +rendering frames-per-second. See below for an overview of all customization possibilities. You can open the config file within kitty by pressing :sc:`edit_config_file`. -You can also display the current configuration by pressing the -:sc:`debug_config` key. +You can reload the config file within kitty by pressing +:sc:`reload_config_file`. You can also display the current configuration by +pressing the :sc:`debug_config` key. .. _confloc: diff --git a/kitty/boss.py b/kitty/boss.py index 6138aad40..073eeec3b 100755 --- a/kitty/boss.py +++ b/kitty/boss.py @@ -1458,7 +1458,7 @@ class Boss: self.default_bg_changed_for(w.id) w.refresh() - def load_config(self, *paths: str, apply_overrides: bool = True) -> None: + def load_config_file(self, *paths: str, apply_overrides: bool = True) -> None: from .config import load_config old_opts = get_options() paths = paths or old_opts.config_paths diff --git a/kitty/options/definition.py b/kitty/options/definition.py index 13b822bdd..0f8bb434e 100644 --- a/kitty/options/definition.py +++ b/kitty/options/definition.py @@ -3277,11 +3277,30 @@ and clear the screen, instead of just clearing the screen:: map('Reset the terminal', 'reset_terminal cmd+option+r clear_terminal reset active', - only="macos" + only="macos", + ) + +map('Reload kitty.conf', + 'reload_config_file kitty_mod+f5 load_config_file', + long_text=''' +Reload kitty.conf, applying any changes since the last time it was loaded. +Note that a handful of settings cannot be dynamically changed and require a +full restart of kitty. You can also map a keybinding to load a different +config file, for example:: + + map f5 load_config /path/to/alternative/kitty.conf + +Note that all setting from the original kitty.conf are discarded, in other words +the new conf settings *replace* the old ones. +''' ) map('Debug kitty configuration', - 'debug_config kitty_mod+f6 debug_config' + 'debug_config kitty_mod+f6 debug_config', + long_text=''' +Show details about exactly what configuration kitty is running with and +its host environment. Useful for debugging issues. +''' ) map('Send arbitrary text on key presses', diff --git a/kitty/options/types.py b/kitty/options/types.py index 97a78ea80..2259e347f 100644 --- a/kitty/options/types.py +++ b/kitty/options/types.py @@ -804,6 +804,8 @@ defaults.map = [ KeyDefinition(True, KeyAction('set_background_opacity', ('default',)), 1024, False, 97, (SingleKey(mods=0, is_native=False, key=100),)), # reset_terminal KeyDefinition(False, KeyAction('clear_terminal', ('reset', True)), 1024, False, 57349, ()), + # reload_config_file + KeyDefinition(False, KeyAction('load_config_file'), 1024, False, 57368, ()), # debug_config KeyDefinition(False, KeyAction('debug_config'), 1024, False, 57369, ()), ] diff --git a/kitty/options/utils.py b/kitty/options/utils.py index 87e46348e..cf57697d2 100644 --- a/kitty/options/utils.py +++ b/kitty/options/utils.py @@ -350,8 +350,8 @@ def mouse_selection(func: str, rest: str) -> FuncArgsType: return func, [cmap[rest]] -@func_with_args('load_config') -def load_config(func: str, rest: str) -> FuncArgsType: +@func_with_args('load_config_file') +def load_config_file(func: str, rest: str) -> FuncArgsType: import shlex return func, shlex.split(rest) # }}}