Entry point to edit config file

This commit is contained in:
Kovid Goyal 2020-11-04 16:30:29 +05:30
parent ef6164eecb
commit c440470276
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 13 additions and 0 deletions

View File

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

View File

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