summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2019-10-10 20:26:27 +1100
committerMaxime Coste <mawww@kakoune.org>2019-10-10 20:26:27 +1100
commit081595fa2f46ff6a5ac80e4fbfd408564ee924af (patch)
tree41fa924c469dd9ea780bb76301f185f7f579b687
parentf2fa260929df58cb4f156f89bdefa5f82c92b9e0 (diff)
Support specifying the user configuration with KAKOUNE_CONFIG_DIR
Fixes #3072 Closes #3081
-rw-r--r--doc/kak.119
-rw-r--r--src/main.cc9
2 files changed, 20 insertions, 8 deletions
diff --git a/doc/kak.1 b/doc/kak.1
index 9dec4890..38530979 100644
--- a/doc/kak.1
+++ b/doc/kak.1
@@ -148,10 +148,11 @@ one or more \fIfile\fRs to edit
.PP
At startup, if \fB\-n\fR is not specified, Kakoune will try to source the file
\fI../share/kak/kakrc\fR relative to the kak binary. This kak file will then
-try to recursively source any files in \fI$XDG_CONFIG_HOME/kak/autoload\fR
-(with \fI$XDG_CONFIG_HOME\fR defaulting to \fI$HOME/.config\fR, and falling back
-to \fI../share/kak/autoload\fR if that autoload directory does not exist),
-and finally \fI$XDG_CONFIG_HOME/kak/kakrc\fR.
+try to recursively source any files in \fI$KAKOUNE_CONFIG_DIR/autoload\fR
+(with \fI$KAKOUNE_CONFIG_DIR\fR defaulting to \fI$XDG_CONFIG_HOME/kak\fR
+if \fI$XDG_CONFIG_HOME\fR is set, \fI$HOME/.config/kak\fR if it is not,
+and falling back to \fI../share/kak/autoload\fR if that autoload directory
+does not exist), and finally \fI$XDG_CONFIG_HOME/kak/kakrc\fR.
That leads to the following behaviour: by default, with no user autoload
directory, the system wide autoload directory is used, once the user wants
@@ -189,6 +190,16 @@ kak \-f "ggO// kak: tabstop=8<esc>" *.c
.RE
.fi
+.SH ENVIRONMENT
+
+.TP
+.BR KAKOUNE_POSIX_SHELL
+Overrides the posix shell binary path to use for \fI%sh{...}\fR expansion.
+
+.TP
+.BR KAKOUNE_CONFIG_DIR
+Overrides the location of the directory containing kakoune user configuration.
+
.SH FILES
If not started with the \fB\-n\fR switch, Kakoune will source the \fI../share/kak/kakrc\fR file relative to the kak binary,
diff --git a/src/main.cc b/src/main.cc
index e725afc5..de2dba2d 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -123,10 +123,11 @@ String runtime_directory()
String config_directory()
{
- StringView config_home = getenv("XDG_CONFIG_HOME");
- if (config_home.empty())
- return format("{}/.config/kak", homedir());
- return format("{}/kak", config_home);
+ if (StringView kak_cfg_dir = getenv("KAKOUNE_CONFIG_DIR"); not kak_cfg_dir.empty())
+ return kak_cfg_dir.str();
+ if (StringView xdg_cfg_home = getenv("XDG_CONFIG_HOME"); not xdg_cfg_home.empty())
+ return format("{}/kak", xdg_cfg_home);
+ return format("{}/.config/kak", homedir());
}
static const EnvVarDesc builtin_env_vars[] = { {