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