Twee support in ctags

To be able to jump between functions in vim:

  1. Install tagbar plugin.

  2. Add this to ~/.ctags file

--langdef=twee
--langmap=twee:.twee.twee2
--regex-twee=/^::([a-zA-Z0-9_$]+)/\1/f,functions/
  1. And this to ~/.vimrc file:
let g:tagbar_type_twee = {
  \ 'ctagstype' : 'twee',
  \ 'kinds'     : [
    \ 'f:functions',
  \ ]
\ }

I’m too lazy to add link regexes right now but hey this is a thread so I hope this will be useful for someone.

3 Likes

Thanks for this!
Though I found this too restrictive; it does not tolerate spaces or dashes as I’ve seen in some stories:

I’m using this instead:

--regex-twee=/^::\s*(.*)$/\1/f,functions/

A SPACE character is used as the separator between one Passage Tag and another.

:: Name of Passage [tag1 tag2 tag3]

A Dash or Minus Sign can be used as part of the name of a Passage Tag.

:: Name of Passage [tag-1 tag-2 tag-3]

The offical TWEE3 Specification contains more details about the structure of a TWEE Notation related file.

1 Like

--regex-twee=/^::\s*([^[{]+)/\1/f,functions/

this works for all these cases:

1 Like