1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-12-22 02:51:32 +03:00
kakoune/share/kak/kakrc

62 lines
1.6 KiB
Plaintext
Raw Normal View History

def -shell-params runtime %{ %sh{
2015-05-29 15:50:35 +03:00
while [ $# -gt 0 ]; do
echo "source '${kak_runtime}/$1'"
shift
done
}}
def -shell-params -docstring "colorscheme <name>: enable named colorscheme" \
2015-07-03 23:14:34 +03:00
-shell-completion %{
prefix=${1:0:${kak_pos_in_token}}
(
localconfdir=${XDG_CONFIG_HOME:-${HOME}/.config}/kak
for col in ${kak_runtime}/colors/*.kak ${localconfdir}/colors/*.kak; do
candidate=$(basename "${col}" .kak)
case ${candidate} in
\**) ;;
${prefix}*) echo ${candidate} ;;
esac
2015-07-03 23:14:34 +03:00
done
) | sort -u
2015-07-03 23:14:34 +03:00
} \
colorscheme %{ %sh{
localconfdir=${XDG_CONFIG_HOME:-${HOME}/.config}/kak
2015-07-03 23:14:34 +03:00
if [ $# -eq 1 ]; then
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
echo -color Error 'Usage: colorscheme <scheme name>'
fi
}}
%sh{
autoload() {
dir=$1
for rcfile in ${dir}/*.kak; do
echo "try %{ source '${rcfile}' } catch %{ }";
done
for subdir in ${dir}/*; do
if [ -d "$subdir" ]; then
autoload $subdir
fi
done
}
localconfdir=${XDG_CONFIG_HOME:-${HOME}/.config}/kak
echo "colorscheme default"
2013-03-22 16:45:52 +04:00
if [ -d "${localconfdir}/autoload" ]; then
autoload ${localconfdir}/autoload
elif [ -d "${kak_runtime}/autoload" ]; then
autoload ${kak_runtime}/autoload
fi
2013-03-22 16:45:52 +04:00
if [ -f "${localconfdir}/kakrc" ]; then
echo "source '${localconfdir}/kakrc'"
fi
}