1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-12-25 20:41:49 +03:00

ctags.kak: Fix compatibility with OSX by using custom realpath implementation

This commit is contained in:
Maxime Coste 2018-03-30 09:30:18 +11:00
parent 8eee5500ea
commit 510be03910

View File

@ -8,9 +8,10 @@ declare-option -docstring "colon separated list of paths to tag files to parse w
define-command -params ..1 \
-shell-candidates '
realpath() { ( path=$(readlink "$1"); cd "$(dirname "$1")"; printf "%s/%s\n" "$(pwd -P)" "$(basename "$1")" ) }
printf %s\\n "$kak_opt_ctagsfiles" | tr \':\' \'\n\' |
while read -r candidate; do
[ -f "$candidate" ] && readlink -f "$candidate"
[ -f "$candidate" ] && realpath "$candidate"
done | awk \'!x[$0]++\' | # remove duplicates
while read -r tags; do
namecache="${tags%/*}/.kak.${tags##*/}.namecache"
@ -23,13 +24,14 @@ define-command -params ..1 \
If no symbol is passed then the current selection is used as symbol name} \
ctags-search \
%{ %sh{
realpath() { ( path=$(readlink "$1"); cd "$(dirname "$1")"; printf "%s/%s\n" "$(pwd -P)" "$(basename "$1")" ) }
export tagname=${1:-${kak_selection}}
printf %s\\n "$kak_opt_ctagsfiles" | tr ':' '\n' |
while read -r candidate; do
[ -f "$candidate" ] && readlink -f "$candidate"
[ -f "$candidate" ] && realpath "$candidate"
done | awk '!x[$0]++' | # remove duplicates
while read -r tags; do
printf '!TAGROOT\t%s\n' "$(readlink -f "${tags%/*}")/"
printf '!TAGROOT\t%s\n' "$(realpath "${tags%/*}")/"
readtags -t "$tags" $tagname
done | awk -F '\t|\n' '
/^!TAGROOT\t/ { tagroot=$2 }