1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-12-18 17:02:06 +03:00

cpp.kak: fix alt_dirs handling with more than 2 directories

This commit is contained in:
Maxime Coste 2013-03-28 14:28:15 +01:00
parent 96b017f76e
commit 08873a779a

View File

@ -38,7 +38,7 @@ decl str-list alt_dirs ".,.."
def alt %{ %sh{
shopt -s extglob
alt_dirs=${kak_opt_alt_dirs/,/ }
alt_dirs=${kak_opt_alt_dirs//,/ }
file=$(basename ${kak_bufname})
dir=$(dirname ${kak_bufname})
@ -46,13 +46,13 @@ def alt %{ %sh{
*.c|*.cc|*.cpp|*.cxx|*.C)
for alt_dir in ${alt_dirs}; do
altname=$(ls -1 "${dir}/${alt_dir}/${file%.*}".@(h|hh|hpp|hxx|H) 2> /dev/null | head -n 1)
[[ -n ${altname} ]] && break
[[ -e ${altname} ]] && break
done
;;
*.h|*.hh|*.hpp|*.hxx|*.H)
for alt_dir in ${alt_dirs}; do
altname=$(ls -1 "${dir}/${alt_dir}/${file%.*}".@(c|cc|cpp|cxx|C) 2> /dev/null | head -n 1)
[[ -n ${altname} ]] && break
[[ -e ${altname} ]] && break
done
;;
esac