From c8627c97136163725913b0aec4060955f35ce48a Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 16 Nov 2019 10:05:25 +0530 Subject: [PATCH] Expand user/env vars in csutomize processing path and note that absolute paths can be used in the docs for it. --- kittens/hints/main.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/kittens/hints/main.py b/kittens/hints/main.py index 302e8d54e..6b5490705 100644 --- a/kittens/hints/main.py +++ b/kittens/hints/main.py @@ -325,7 +325,11 @@ def parse_input(text): def load_custom_processor(customize_processing): from kitty.constants import config_dir - custom_path = os.path.join(config_dir, customize_processing) + customize_processing = os.path.expandvars(os.path.expanduser(customize_processing)) + if os.path.isabs(customize_processing): + custom_path = customize_processing + else: + custom_path = os.path.join(config_dir, customize_processing) import runpy return runpy.run_path(custom_path, run_name='__main__') @@ -451,7 +455,7 @@ the second character you specify. Name of a python file in the kitty config directory which will be imported to provide custom implementations for pattern finding and performing actions on selected matches. See https://sw.kovidgoyal.net/kitty/kittens/hints.html -for details. +for details. You can also specify absolute paths to load the script from elsewhere. '''.format(','.join(sorted(URL_PREFIXES))).format