diff --git a/__main__.py b/__main__.py index c848929c8..83c7311f7 100644 --- a/__main__.py +++ b/__main__.py @@ -65,6 +65,11 @@ def run_kitten(args: List[str]) -> None: rk(kitten) +def edit_config_file(args: List[str]) -> None: + from kitty.utils import edit_config_file as f + f() + + def namespaced(args: List[str]) -> None: func = namespaced_entry_points[args[1]] func(args[1:]) @@ -77,6 +82,7 @@ entry_points = { 'runpy': runpy, 'launch': launch, 'kitten': run_kitten, + 'edit-config': edit_config_file, '@': remote_control, '+': namespaced, diff --git a/kitty/utils.py b/kitty/utils.py index 28d31117b..e435770f7 100644 --- a/kitty/utils.py +++ b/kitty/utils.py @@ -580,6 +580,13 @@ def parse_uri_list(text: str) -> Generator[str, None, None]: yield unquote(purl.path) +def edit_config_file() -> None: + from kitty.config import prepare_config_file_for_editing + p = prepare_config_file_for_editing() + editor = get_editor() + os.execvp(editor[0], editor + [p]) + + class SSHConnectionData(NamedTuple): binary: str hostname: str