diff --git a/kitty/utils.py b/kitty/utils.py index 2fa015052..afd64ed25 100644 --- a/kitty/utils.py +++ b/kitty/utils.py @@ -17,6 +17,7 @@ from typing import ( Any, BinaryIO, NamedTuple, + NoReturn, Optional, cast, ) @@ -580,6 +581,15 @@ def get_editor(opts: Options | None = None, path_to_edit: str = '', line_number: return ans +def edit_file(path: str = '') -> NoReturn: + ' This exists for: map whatever launch kitty +runpy "from kitty.utils import *; edit_file()" to edit kitty config ' + from .config import prepare_config_file_for_editing + editor = get_editor() + path = path or prepare_config_file_for_editing() + editor.append(path) + os.execlp(editor[0], *editor) + + def is_path_in_temp_dir(path: str) -> bool: if not path: return False