Skip to content

Commit 811b4fa

Browse files
committed
Fix #9083
1 parent c2e75ba commit 811b4fa

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

kitty/utils.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
Any,
1818
BinaryIO,
1919
NamedTuple,
20+
NoReturn,
2021
Optional,
2122
cast,
2223
)
@@ -580,6 +581,15 @@ def get_editor(opts: Options | None = None, path_to_edit: str = '', line_number:
580581
return ans
581582

582583

584+
def edit_file(path: str = '') -> NoReturn:
585+
' This exists for: map whatever launch kitty +runpy "from kitty.utils import *; edit_file()" to edit kitty config '
586+
from .config import prepare_config_file_for_editing
587+
editor = get_editor()
588+
path = path or prepare_config_file_for_editing()
589+
editor.append(path)
590+
os.execlp(editor[0], *editor)
591+
592+
583593
def is_path_in_temp_dir(path: str) -> bool:
584594
if not path:
585595
return False

0 commit comments

Comments
 (0)