summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2015-07-18 23:32:48 +0100
committerMaxime Coste <frrrwww@gmail.com>2015-07-18 23:32:48 +0100
commitc0f14fe69584bf9e2c8ef8aefacbd820e55ed7a7 (patch)
tree82fe09828fba4c6200accf0b0572f58dfb73f460
parentd4525f70943d8720173d47b50c3b5d0ae3e88e75 (diff)
parentaf5386d8bda1103fcee7b7aaa6ea8ab68b101ff5 (diff)
Merge remote-tracking branch 'ekie/load_color_userspace'
-rw-r--r--README.asciidoc18
-rw-r--r--share/kak/kakrc19
2 files changed, 25 insertions, 12 deletions
diff --git a/README.asciidoc b/README.asciidoc
index c6468772..347b2840 100644
--- a/README.asciidoc
+++ b/README.asciidoc
@@ -594,12 +594,15 @@ line using:
:echo %sh{ ls -l $kak_bufname }
-------------------------------
+Configuration & Autoloading
+---------------------------
+
Kakrc
------
+~~~~~
If not launched with the `-n` switch, Kakoune will source the
-`../share/kak/kakrc` file (relative to the `kak` binary), which
-will in turn source additional files:
+`../share/kak/kakrc` file relative to the `kak` binary, which
+will source additional files:
If the `$XDG_CONFIG_HOME/kak/autoload` directory exists, load every
`*.kak` files in it, and load recursively any subdirectory.
@@ -614,6 +617,15 @@ In order to continue autoloading site-wide files with a local autoload
directory, just add a symbolic link to `../share/kak/autoload/` into
your local autoload directory.
+Color Schemes
+~~~~~~~~~~~~~
+
+Kakoune ships with some color schemes that are installed to
+`../share/kak/colors/`. If `$XDG_CONFIG_HOME/kak/colors/` is present
+the builtin commmand `colorscheme` will offer completion for those
+color schemes. If a scheme is duplicated in userspace it will take
+precedence.
+
Options
-------
diff --git a/share/kak/kakrc b/share/kak/kakrc
index beccc284..3e91e3d5 100644
--- a/share/kak/kakrc
+++ b/share/kak/kakrc
@@ -34,14 +34,20 @@ def -shell-params -docstring "colorscheme <name>: enable named colorscheme" \
-shell-completion %{
prefix=${1:0:${kak_pos_in_token}}
(
- for col in ${kak_runtime}/colors/*.kak; do
+ localconfdir=${XDG_CONFIG_HOME:-${HOME}/.config}/kak
+ for col in ${kak_runtime}/colors/*.kak ${localconfdir}/colors/*.kak; do
expr $(basename "${col}" .kak) : "^\(${prefix}.*\)$"
done
- ) | grep -v '^$'
+ ) | sort -u | grep -v '^$'
} \
colorscheme %{ %sh{
+ localconfdir=${XDG_CONFIG_HOME:-${HOME}/.config}/kak
if [ $# -eq 1 ]; then
- echo "source '${kak_runtime}/colors/$1.kak'"
+ if [ -f "${localconfdir}/colors/$1.kak" ];then
+ echo "source '${localconfdir}/colors/$1.kak'"
+ else
+ echo "source '${kak_runtime}/colors/$1.kak'"
+ fi
else
echo -color Error 'Usage: colorscheme <scheme name>'
fi
@@ -60,12 +66,7 @@ def -shell-params -docstring "colorscheme <name>: enable named colorscheme" \
done
}
- if [ -n "${XDG_CONFIG_HOME}" ]; then
- localconfdir="${XDG_CONFIG_HOME}/kak"
- else
- localconfdir="$HOME/.config/kak"
- fi
-
+ localconfdir=${XDG_CONFIG_HOME:-${HOME}/.config}/kak
if [ -d "${localconfdir}/autoload" ]; then
autoload ${localconfdir}/autoload
elif [ -d "${kak_runtime}/autoload" ]; then