mirror of
https://github.com/mawww/kakoune.git
synced 2024-12-02 23:21:15 +03:00
Add a rc/ctags.kak for a :tag implementation using exuberant ctags
This commit is contained in:
parent
478581cc46
commit
2781056ce6
26
src/rc/ctags.kak
Normal file
26
src/rc/ctags.kak
Normal file
@ -0,0 +1,26 @@
|
||||
# Kakoune Exuberant CTags support script
|
||||
#
|
||||
# This script requires the readtags command available in ctags source but
|
||||
# not installed by default
|
||||
|
||||
def -shell-params \
|
||||
-shell-completion 'readtags -p "$1" | cut -f 1 | sort | uniq' \
|
||||
tag \
|
||||
%{ %sh{
|
||||
if [[ -z "$1" ]]; then tagname=${kak_selection}; else tagname=$1; fi
|
||||
matches=$(readtags ${tagname})
|
||||
if [[ -z "${matches}" ]]; then
|
||||
echo "echo tag not found ${tagname}"
|
||||
else
|
||||
menuparam=$(readtags ${tagname} | perl -i -ne '
|
||||
/([^\t]+)\t([^\t]+)\t\/\^(.*)\$\// and print "%{$2 [$3]} %{try %{ edit %{$2}; exec %{%s\\Q$3<ret>} } catch %{ echo %{unable to find tag} } } ";
|
||||
/([^\t]+)\t([^\t]+)\t(\d+)/ and print "%{$2:$3} %{edit %{$2}; exec %{$3g}} ";
|
||||
')
|
||||
|
||||
if [[ -z "${menuparam}" ]]; then
|
||||
echo "echo no such tag ${tagname}";
|
||||
else
|
||||
echo "menu -auto-single ${menuparam//$'\n'/ }";
|
||||
fi
|
||||
fi
|
||||
}}
|
Loading…
Reference in New Issue
Block a user