kakrc: Simplify and optimize the autoload function
This commit is contained in:
parent
3a0d9481ac
commit
d5726c0cfd
|
@ -24,17 +24,8 @@ def -params 1 -docstring "colorscheme <name>: enable named colorscheme" \
|
||||||
|
|
||||||
%sh{
|
%sh{
|
||||||
autoload_directory() {
|
autoload_directory() {
|
||||||
dir=$1
|
find -L "$1" -type f -name '*\.kak' \
|
||||||
for rcfile in ${dir}/*.kak; do
|
-exec printf 'try %%{ source "%s" } catch %%{ echo -debug Autoload: could not load "%s" }\n' '{}' '{}' \;
|
||||||
if [ -f "$rcfile" ]; then
|
|
||||||
echo "try %{ source '${rcfile}' } catch %{ echo -debug Autoload: could not load '${rcfile}' }";
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
for subdir in ${dir}/*; do
|
|
||||||
if [ -d "$subdir" ]; then
|
|
||||||
autoload_directory $subdir
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
}
|
}
|
||||||
|
|
||||||
localconfdir=${XDG_CONFIG_HOME:-${HOME}/.config}/kak
|
localconfdir=${XDG_CONFIG_HOME:-${HOME}/.config}/kak
|
||||||
|
|
Loading…
Reference in New Issue
Block a user