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