summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteven Chan <steven3416@gmail.com>2019-01-28 11:18:12 -0800
committerSteven Chan <steven3416@gmail.com>2019-01-29 11:17:23 -0800
commit568d46bf727cd284d7a5e9d5acf08ffffb2e6723 (patch)
tree412728f0660388279fa9706c249931ef2435f677
parent3e89148d74c3d4a9ba075b0d9218457e845982e6 (diff)
Fix and simplify ctags-funcinfo command
1. Enable the command to correctly show the prefix of a function name [prefix::basename], where prefix is the value gotten from a class, struct, or namespace field of the tag line. 2. Use a readtag filter expression to replace a use of grep.
-rw-r--r--rc/base/ctags.kak5
1 files changed, 4 insertions, 1 deletions
diff --git a/rc/base/ctags.kak b/rc/base/ctags.kak
index d860f3d8..aaa3d514 100644
--- a/rc/base/ctags.kak
+++ b/rc/base/ctags.kak
@@ -62,7 +62,10 @@ define-command ctags-funcinfo -docstring "Display ctags information about a sele
try %{
execute-keys '[(;B<a-k>[a-zA-Z_]+\(<ret><a-;>'
evaluate-commands %sh{
- sigs=$(readtags -e ${kak_selection%?} | grep kind:f | sed -re 's/^(\S+).*((class|struct|namespace):(\S+))?.*signature:(.*)$/\5 [\4::\1]/')
+ f=${kak_selection%?}
+ sig='\tsignature:(.*)'
+ csn='\t(class|struct|namespace):(\S+)'
+ sigs=$(readtags -e -Q '(eq? $kind "f")' "${f}" | sed -re "s/^.*${csn}.*${sig}$/\3 [\2::${f}]/ ;t ;s/^.*${sig}$/\1 [${f}]/")
if [ -n "$sigs" ]; then
printf %s\\n "evaluate-commands -client ${kak_client} %{info -anchor $kak_cursor_line.$kak_cursor_column -placement above '$sigs'}"
fi