2015-12-01 15:00:55 +01:00
|
|
|
def -params 1.. runtime %{ %sh{
|
2015-05-29 14:50:35 +02:00
|
|
|
while [ $# -gt 0 ]; do
|
|
|
|
echo "source '${kak_runtime}/$1'"
|
|
|
|
shift
|
|
|
|
done
|
2012-09-10 20:45:34 +02:00
|
|
|
}}
|
2012-01-14 02:04:08 +01:00
|
|
|
|
2015-12-01 15:00:55 +01:00
|
|
|
def -params 1 -docstring "colorscheme <name>: enable named colorscheme" \
|
2015-07-03 22:14:34 +02:00
|
|
|
-shell-completion %{
|
2016-04-11 22:12:36 +02:00
|
|
|
prefix=$(printf %s "$1" | cut -c1-${kak_pos_in_token} 2> /dev/null)
|
2015-07-03 22:14:34 +02:00
|
|
|
(
|
2015-07-17 15:36:57 +02:00
|
|
|
localconfdir=${XDG_CONFIG_HOME:-${HOME}/.config}/kak
|
|
|
|
for col in ${kak_runtime}/colors/*.kak ${localconfdir}/colors/*.kak; do
|
2015-07-20 14:14:08 +02:00
|
|
|
candidate=$(basename "${col}" .kak)
|
|
|
|
case ${candidate} in
|
|
|
|
\**) ;;
|
|
|
|
${prefix}*) echo ${candidate} ;;
|
|
|
|
esac
|
2015-07-03 22:14:34 +02:00
|
|
|
done
|
2015-07-20 14:14:08 +02:00
|
|
|
) | sort -u
|
2015-07-03 22:14:34 +02:00
|
|
|
} \
|
|
|
|
colorscheme %{ %sh{
|
2015-07-17 15:36:57 +02:00
|
|
|
localconfdir=${XDG_CONFIG_HOME:-${HOME}/.config}/kak
|
2015-07-03 22:14:34 +02:00
|
|
|
if [ $# -eq 1 ]; then
|
2015-07-17 15:36:57 +02:00
|
|
|
if [ -f "${localconfdir}/colors/$1.kak" ];then
|
|
|
|
echo "source '${localconfdir}/colors/$1.kak'"
|
|
|
|
else
|
|
|
|
echo "source '${kak_runtime}/colors/$1.kak'"
|
|
|
|
fi
|
2015-07-03 22:14:34 +02:00
|
|
|
else
|
|
|
|
echo -color Error 'Usage: colorscheme <scheme name>'
|
|
|
|
fi
|
2015-07-02 14:56:38 +02:00
|
|
|
}}
|
|
|
|
|
2012-09-10 20:45:34 +02:00
|
|
|
%sh{
|
2015-05-30 15:32:04 +02:00
|
|
|
autoload() {
|
|
|
|
dir=$1
|
|
|
|
for rcfile in ${dir}/*.kak; do
|
2016-01-29 09:48:26 +01:00
|
|
|
if [ -f "$rcfile" ]; then
|
|
|
|
echo "try %{ source '${rcfile}' } catch %{ echo -debug Autoload: could not load '${rcfile}' }";
|
|
|
|
fi
|
2015-05-30 15:32:04 +02:00
|
|
|
done
|
|
|
|
for subdir in ${dir}/*; do
|
|
|
|
if [ -d "$subdir" ]; then
|
|
|
|
autoload $subdir
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2015-07-17 15:36:57 +02:00
|
|
|
localconfdir=${XDG_CONFIG_HOME:-${HOME}/.config}/kak
|
2015-07-19 05:38:52 +02:00
|
|
|
|
|
|
|
echo "colorscheme default"
|
|
|
|
|
2013-03-22 13:45:52 +01:00
|
|
|
if [ -d "${localconfdir}/autoload" ]; then
|
2015-05-30 15:32:04 +02:00
|
|
|
autoload ${localconfdir}/autoload
|
|
|
|
elif [ -d "${kak_runtime}/autoload" ]; then
|
|
|
|
autoload ${kak_runtime}/autoload
|
2012-09-10 20:45:34 +02:00
|
|
|
fi
|
2015-05-30 15:32:04 +02:00
|
|
|
|
2016-03-27 20:34:59 +02:00
|
|
|
if [ -f "${kak_runtime}/kakrc.local" ]; then
|
|
|
|
echo "source '${kak_runtime}/kakrc.local'"
|
|
|
|
fi
|
|
|
|
|
2013-03-22 13:45:52 +01:00
|
|
|
if [ -f "${localconfdir}/kakrc" ]; then
|
2012-12-06 20:30:34 +01:00
|
|
|
echo "source '${localconfdir}/kakrc'"
|
|
|
|
fi
|
2012-09-10 20:45:34 +02:00
|
|
|
}
|