From e07d216a112c3152a2f48ab51d1567fb721912b3 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 9 May 2018 09:35:50 +0530 Subject: [PATCH] Expand environment variables in config file include directives --- kitty/config_utils.py | 2 +- kitty/kitty.conf | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/kitty/config_utils.py b/kitty/config_utils.py index 688f89fc8..52d4de695 100644 --- a/kitty/config_utils.py +++ b/kitty/config_utils.py @@ -48,7 +48,7 @@ def parse_line(line, type_map, special_handling, ans, all_keys, base_path_for_in if special_handling(key, val, ans): return if key == 'include': - val = val.strip() + val = os.path.expandvars(os.path.expanduser(val.strip())) if not os.path.isabs(val): val = os.path.join(base_path_for_includes, val) try: diff --git a/kitty/kitty.conf b/kitty/kitty.conf index fa6e9bb90..6de0cb766 100644 --- a/kitty/kitty.conf +++ b/kitty/kitty.conf @@ -2,7 +2,9 @@ # You can include secondary config files via the "include" directive. # If you use a relative path for include, it is resolved with respect to the -# location of the current config file. For example: +# location of the current config file. Note that environment variables +# are expanded, so ${USER}.conf becomes name.conf if USER=name +# For example: # include other.conf # Fonts {{{