summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/main.cc b/src/main.cc
index b9f995f6..aff7f9f2 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -68,6 +68,14 @@ String runtime_directory()
return "/usr/share/kak";
}
+String config_directory()
+{
+ StringView config_home = getenv("XDG_CONFIG_HOME");
+ if (config_home.empty())
+ return format("{}/.config/kak", getenv("HOME"));
+ return format("{}/kak", config_home);
+}
+
void register_env_vars()
{
static const struct {
@@ -113,6 +121,10 @@ void register_env_vars()
[](StringView name, const Context& context)
{ return runtime_directory(); }
}, {
+ "config", false,
+ [](StringView name, const Context& context)
+ { return config_directory(); }
+ }, {
"opt_", true,
[](StringView name, const Context& context)
{ return context.options()[name.substr(4_byte)].get_as_string(); }