mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-14 12:34:44 +02:00
Nicer error message when trying to open the config file and no editor is available
This commit is contained in:
@@ -81,6 +81,25 @@ def launch(args: List[str]) -> None:
|
||||
runpy.run_path(exe, run_name='__main__')
|
||||
|
||||
|
||||
def edit(args: List[str]) -> None:
|
||||
import shutil
|
||||
from .constants import is_macos
|
||||
if is_macos:
|
||||
# On macOS vim fails to handle SIGWINCH if it occurs early, so add a small delay.
|
||||
import time
|
||||
time.sleep(0.05)
|
||||
exe = args[1]
|
||||
if not os.path.isabs(exe):
|
||||
exe = shutil.which(exe) or ''
|
||||
if not exe or not os.access(exe, os.X_OK):
|
||||
print('Cannot find an editor on your system. Set the \x1b[33meditor\x1b[39m value in kitty.conf'
|
||||
' to the absolute path of your editor of choice.', file=sys.stderr)
|
||||
from kitty.utils import hold_till_enter
|
||||
hold_till_enter()
|
||||
raise SystemExit(1)
|
||||
os.execv(exe, args[1:])
|
||||
|
||||
|
||||
def shebang(args: List[str]) -> None:
|
||||
script_path = args[1]
|
||||
cmd = args[2:]
|
||||
@@ -152,6 +171,7 @@ namespaced_entry_points['open'] = open_urls
|
||||
namespaced_entry_points['kitten'] = run_kitten
|
||||
namespaced_entry_points['edit-config'] = edit_config_file
|
||||
namespaced_entry_points['shebang'] = shebang
|
||||
namespaced_entry_points['edit'] = edit
|
||||
|
||||
|
||||
def setup_openssl_environment(ext_dir: str) -> None:
|
||||
|
||||
Reference in New Issue
Block a user