2015-12-01 15:00:55 +01:00
|
|
|
def -params 1 -docstring "colorscheme <name>: enable named colorscheme" \
|
2018-02-22 11:35:39 +01:00
|
|
|
-shell-candidates %{
|
|
|
|
find -L "${kak_runtime}/colors" "${kak_config}/colors" -type f -name '*\.kak' \
|
|
|
|
| while read -r path_colorscheme; do
|
|
|
|
basename="${path_colorscheme##*/}"
|
|
|
|
printf %s\\n "${basename%.*}"
|
|
|
|
done | sort -u
|
2015-07-03 22:14:34 +02:00
|
|
|
} \
|
|
|
|
colorscheme %{ %sh{
|
2018-02-22 11:35:39 +01:00
|
|
|
find_colorscheme() {
|
|
|
|
find -L "${1}" -type f -name "${2}\\.kak" | head -n 1
|
|
|
|
}
|
|
|
|
|
|
|
|
if [ $# -lt 1 ]; then
|
|
|
|
echo "echo -markup '{Error}Usage: colorscheme <scheme name>'"
|
|
|
|
else
|
|
|
|
path_colorscheme=$(find_colorscheme "${kak_config}/colors" "${1}")
|
|
|
|
if [ -z "${path_colorscheme}" ];then
|
|
|
|
path_colorscheme=$(find_colorscheme "${kak_runtime}/colors" "${1}")
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -z "${path_colorscheme}" ]; then
|
|
|
|
echo "echo -markup '{Error}No such colorscheme'"
|
2015-07-17 15:36:57 +02:00
|
|
|
else
|
2018-02-22 11:35:39 +01:00
|
|
|
printf 'source %%{%s}' "${path_colorscheme}"
|
2015-07-17 15:36:57 +02:00
|
|
|
fi
|
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
|
|
|
}
|