diff --git a/kitty/cli.py b/kitty/cli.py index 126f62524..9cbac5a15 100644 --- a/kitty/cli.py +++ b/kitty/cli.py @@ -16,7 +16,7 @@ from .cli_stub import CLIOptions from .conf.utils import resolve_config from .constants import ( appname, clear_handled_signals, config_dir, defconf, is_macos, str_version, - website_url + website_url, default_pager_for_help ) from .fast_data_types import wcswidth from .options.types import Options as KittyOpts @@ -474,12 +474,16 @@ class PrintHelpForSeq: text = '\n'.join(blocks) + '\n\n' + version() if print_help_for_seq.allow_pager and sys.stdout.isatty(): import subprocess - p = subprocess.Popen(['less', '-iRXF'], stdin=subprocess.PIPE, preexec_fn=clear_handled_signals) try: - p.communicate(text.encode('utf-8')) - except KeyboardInterrupt: - raise SystemExit(1) - raise SystemExit(p.wait()) + p = subprocess.Popen(default_pager_for_help, stdin=subprocess.PIPE, preexec_fn=clear_handled_signals) + except FileNotFoundError: + print(text) + else: + try: + p.communicate(text.encode('utf-8')) + except KeyboardInterrupt: + raise SystemExit(1) + raise SystemExit(p.wait()) else: print(text) diff --git a/kitty/constants.py b/kitty/constants.py index 2edcc3a0e..658bbb41b 100644 --- a/kitty/constants.py +++ b/kitty/constants.py @@ -30,6 +30,7 @@ is_freebsd: bool = 'freebsd' in _plat is_running_from_develop: bool = False RC_ENCRYPTION_PROTOCOL_VERSION = '1' website_base_url = 'https://sw.kovidgoyal.net/kitty/' +default_pager_for_help = ('less', '-iRXF') if getattr(sys, 'frozen', False): extensions_dir: str = getattr(sys, 'kitty_run_data')['extensions_dir']