summaryrefslogtreecommitdiff
path: root/share/kak/kakrc
diff options
context:
space:
mode:
Diffstat (limited to 'share/kak/kakrc')
-rw-r--r--share/kak/kakrc22
1 files changed, 19 insertions, 3 deletions
diff --git a/share/kak/kakrc b/share/kak/kakrc
index f319e832..8a5f77f7 100644
--- a/share/kak/kakrc
+++ b/share/kak/kakrc
@@ -31,16 +31,32 @@ def -shell-params runtime %{ %sh{
}}
%sh{
+ autoload() {
+ dir=$1
+ echo "echo -debug autoloading $dir"
+ for rcfile in ${dir}/*.kak; do
+ echo "echo -debug autoloading $rcfile"
+ echo "try %{ source '${rcfile}' } catch %{ }";
+ done
+ for subdir in ${dir}/*; do
+ if [ -d "$subdir" ]; then
+ autoload $subdir
+ fi
+ done
+ }
+
if [ -n "${XDG_CONFIG_HOME}" ]; then
localconfdir="${XDG_CONFIG_HOME}/kak"
else
localconfdir="$HOME/.config/kak"
fi
+
if [ -d "${localconfdir}/autoload" ]; then
- for rcfile in ${localconfdir}/autoload/*.kak; do
- echo "try %{ source '${rcfile}' } catch %{ }";
- done
+ autoload ${localconfdir}/autoload
+ elif [ -d "${kak_runtime}/autoload" ]; then
+ autoload ${kak_runtime}/autoload
fi
+
if [ -f "${localconfdir}/kakrc" ]; then
echo "source '${localconfdir}/kakrc'"
fi