summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Felice <jason.m.felice@gmail.com>2020-08-04 11:48:34 -0400
committerJason Felice <jason.m.felice@gmail.com>2020-08-04 11:48:34 -0400
commita52822d9650bc4cd6bf2559a54a4fa24b6ed9fc6 (patch)
tree2f6cca04d43c82e07dec27d7daabceb36cee0a94
parenta82d61c14bcb7d519ed7770de5c6bfe1bf0c2894 (diff)
Override runtime by setting $KAKOUNE_RUNTIME
-rw-r--r--doc/pages/expansions.asciidoc4
-rw-r--r--src/main.cc3
2 files changed, 5 insertions, 2 deletions
diff --git a/doc/pages/expansions.asciidoc b/doc/pages/expansions.asciidoc
index 67e0f55a..fdd7629d 100644
--- a/doc/pages/expansions.asciidoc
+++ b/doc/pages/expansions.asciidoc
@@ -306,8 +306,8 @@ The following expansions are supported (with required context _in italics_):
current register when the mapping was triggered
*%val{runtime}*::
- directory containing the kak support files, determined from Kakoune's
- binary location
+ the directory containing the kak support files, which is determined from
+ Kakoune's binary location if `$KAKOUNE_RUNTIME` is not set
*%val{select_mode}*::
_for commands executed from the object menu's `<a-;>` only_ +
diff --git a/src/main.cc b/src/main.cc
index 9385214f..e557d566 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -138,6 +138,9 @@ inline void write_stderr(StringView str) { try { write(STDERR_FILENO, str); } ca
String runtime_directory()
{
+ if (const char* runtime_directory = getenv("KAKOUNE_RUNTIME"))
+ return runtime_directory;
+
char relpath[PATH_MAX+1];
format_to(relpath, "{}../share/kak", split_path(get_kak_binary_path()).first);
struct stat st;