diff options
| author | Maxime Coste <mawww@kakoune.org> | 2018-03-30 09:30:18 +1100 |
|---|---|---|
| committer | Maxime Coste <mawww@kakoune.org> | 2018-03-30 09:30:18 +1100 |
| commit | 510be03910081f320fae600629f23591f4fc207c (patch) | |
| tree | ab7142f19c9e5f986e9245a54fbd2080e7efb2c5 | |
| parent | 8eee5500ea8bf60a36b09f1efc2bc26a02c5bd6d (diff) | |
ctags.kak: Fix compatibility with OSX by using custom realpath implementation
| -rw-r--r-- | rc/base/ctags.kak | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/rc/base/ctags.kak b/rc/base/ctags.kak index 9ca99385..0a549ebc 100644 --- a/rc/base/ctags.kak +++ b/rc/base/ctags.kak @@ -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 } |
