Add a shortcut to reload the config file

This commit is contained in:
Kovid Goyal 2021-06-06 18:48:12 +05:30
parent 7148f262c0
commit 9003c76261
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
6 changed files with 32 additions and 9 deletions

View File

@ -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`

View File

@ -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:

View File

@ -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

View File

@ -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',

View File

@ -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, ()),
]

View File

@ -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)
# }}}