1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-11-30 23:37:17 +03:00

c-family: allow specifying absolute alt directory paths

alt-dirs which start with a / are considered to be absolute
This commit is contained in:
Olivier Perret 2020-11-05 16:55:05 +01:00
parent 94ac3084e1
commit 7e736289ce

View File

@ -415,7 +415,10 @@ define-command -hidden c-family-alternative-file %{
*.c|*.cc|*.cpp|*.cxx|*.C|*.inl|*.m)
for alt_dir in "$@"; do
for ext in h hh hpp hxx H; do
altname="${dir}/${alt_dir}/${file_noext}.${ext}"
case "$alt_dir" in
/*) altname="${alt_dir}/${file_noext}.${ext}" ;;
*) altname="${dir}/${alt_dir}/${file_noext}.${ext}" ;;
esac
if [ -f ${altname} ]; then
printf 'edit %%{%s}\n' "${altname}"
exit
@ -426,7 +429,10 @@ define-command -hidden c-family-alternative-file %{
*.h|*.hh|*.hpp|*.hxx|*.H)
for alt_dir in "$@"; do
for ext in c cc cpp cxx C m; do
altname="${dir}/${alt_dir}/${file_noext}.${ext}"
case "$alt_dir" in
/*) altname="${alt_dir}/${file_noext}.${ext}" ;;
*) altname="${dir}/${alt_dir}/${file_noext}.${ext}" ;;
esac
if [ -f ${altname} ]; then
printf 'edit %%{%s}\n' "${altname}"
exit