From 568d46bf727cd284d7a5e9d5acf08ffffb2e6723 Mon Sep 17 00:00:00 2001 From: Steven Chan Date: Mon, 28 Jan 2019 11:18:12 -0800 Subject: [PATCH] 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. --- rc/base/ctags.kak | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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-zA-Z_]+\(' 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