diff options
| author | Steven Chan <stevenyvr987@users.noreply.github.com> | 2017-02-12 14:07:52 -0800 |
|---|---|---|
| committer | Steven Chan <steven3416@gmail.com> | 2019-01-21 15:09:33 -0800 |
| commit | ae86ffcbf9f12c97a7e75661e73ceeae5f264576 (patch) | |
| tree | 9b45645892f5b4fbb4737d0687528053bfbe9b4e | |
| parent | cb7401439b6027da49c622822ee3498de741f130 (diff) | |
Fixes for ctags.kak
1. Fix #2250. Enable ctags to handle absolute file paths.
Only prepend tagroot to tag location if it is a relative file path.
2. Include signature field in the default ctags command.
The regex for displaying signature info includes a mandatory pattern
for 'signature' field, but the field is not a default option for the ctags command.
If the tags file is generated by the as-is ctags command, pattern matching will fail,
and the whole ctags line for the selected function will be displayed instead.
| -rw-r--r-- | rc/base/ctags.kak | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/rc/base/ctags.kak b/rc/base/ctags.kak index f15eee82..d860f3d8 100644 --- a/rc/base/ctags.kak +++ b/rc/base/ctags.kak @@ -39,10 +39,13 @@ If no symbol is passed then the current selection is used as symbol name} \ re=$0; sub(".*\t/\\^", "", re); sub("\\$?/$", "", re); gsub("(\\{|\\}|\\\\E).*$", "", re); keys=re; gsub(/</, "<lt>", keys); gsub(/\t/, "<c-v><c-i>", keys); - out = out " %{" $2 " {MenuInfo}" re "} %{evaluate-commands %{ try %{ edit %{" tagroot $2 "}; execute-keys %{/\\Q" keys "<ret>vc} } catch %{ echo %{unable to find tag} } } }" + out = out " %{" $2 " {MenuInfo}" re "} %{evaluate-commands %{ try %{ edit %{" path($2) "}; execute-keys %{/\\Q" keys "<ret>vc} } catch %{ echo %{unable to find tag} } } }" } - /[^\t]+\t[^\t]+\t[0-9]+/ { out = out " %{" $2 ":" $3 "} %{evaluate-commands %{ edit %{" tagroot $2 "} %{" $3 "}}}" } - END { print ( length(out) == 0 ? "echo -markup %{{Error}no such tag " ENVIRON["tagname"] "}" : "menu -markup -auto-single " out ) }' + /[^\t]+\t[^\t]+\t[0-9]+/ { out = out " %{" $2 ":" $3 "} %{evaluate-commands %{ edit %{" path($2) "} %{" $3 "}}}" } + END { print ( length(out) == 0 ? "echo -markup %{{Error}no such tag " ENVIRON["tagname"] "}" : "menu -markup -auto-single " out ) } + + # Ensure x is an absolute file path, by prepending with tagroot + function path(x) { return x ~/^\// ? x : tagroot x }' }} define-command ctags-complete -docstring "Insert completion candidates for the current selection into the buffer's local variables" %{ evaluate-commands -draft %{ @@ -76,7 +79,7 @@ define-command ctags-enable-autoinfo -docstring "Automatically display ctags inf define-command ctags-disable-autoinfo -docstring "Disable automatic ctags information displaying" %{ remove-hooks window ctags-autoinfo } declare-option -docstring "shell command to run" \ - str ctagscmd "ctags -R" + str ctagscmd "ctags -R --fields=+S" declare-option -docstring "path to the directory in which the tags file will be generated" str ctagspaths "." define-command ctags-generate -docstring 'Generate tag file asynchronously' %{ |
