Load config file in ${XDG_CONFIG_HOME}/kak/kakrc and ${XDG_CONFIG_HOME}/kak/autload/*

Do not autoload files in $kak_runtime/rc, let the user choose
restore the runtime command implemented in shell this time.
This commit is contained in:
Maxime Coste 2012-09-10 20:45:34 +02:00
parent 82a2bb37e7
commit f8a6045307

View File

@ -1,4 +1,22 @@
hook global WinCreate .* %{ addhl regex \h+(?=\n) 0:default,red } def -shell-params runtime %{ %sh{
hook global WinCreate .* %{ addhl number_lines } while (( "$#" )); do
echo "source '${kak_runtime}/$1'"
shift
done
}}
%sh{ for rcfile in ${kak_runtime}/rc/*; do echo "try %{ source '${rcfile}' } catch %{ }"; done } %sh{
if [[ -n "${XDG_CONFIG_HOME}" ]]; then
localconfdir="${XDG_CONFIG_HOME}/kak"
else
localconfdir="$HOME/.config/kak"
fi
if [[ -f "${localconfdir}/kakrc" ]]; then
echo "source '${localconfdir}/kakrc'"
fi
if [[ -d "${localconfdir}/autoload" ]]; then
for rcfile in ${localconfdir}/autoload/*; do
echo "try %{ source '${rcfile}' } catch %{ }";
done
fi
}