Fix colorscheme completion that triggered a shell syntax error

When the user colors dir was missing, expr was failing, with
the error ending up in the *debug* buffer
This commit is contained in:
Maxime Coste 2015-07-20 13:14:08 +01:00
parent f6fae1b024
commit 79562a614e

View File

@ -11,9 +11,13 @@ def -shell-params -docstring "colorscheme <name>: enable named colorscheme" \
(
localconfdir=${XDG_CONFIG_HOME:-${HOME}/.config}/kak
for col in ${kak_runtime}/colors/*.kak ${localconfdir}/colors/*.kak; do
expr $(basename "${col}" .kak) : "^\(${prefix}.*\)$"
candidate=$(basename "${col}" .kak)
case ${candidate} in
\**) ;;
${prefix}*) echo ${candidate} ;;
esac
done
) | sort -u | grep -v '^$'
) | sort -u
} \
colorscheme %{ %sh{
localconfdir=${XDG_CONFIG_HOME:-${HOME}/.config}/kak