質問

I use Vim with ctags and Taglist plugins. When editing .vhd files, the tags are very poor (only the entity is displayed).

I don't know if ctags support for VHDL is weak or if Taglist is reading unefficiently the file created by ctags.

How can I fix that ? Is there another solution to create better tag for vhdl with ctags/taglist ?

Thanks a lot.

役に立ちましたか?

解決

If you find ctags' support for something insufficient, you can extend it by adding a series of declarations to a .ctags file in your home directory. For example, for VHDL you could use the code found here:

--langdef=vhdl
--langmap=vhdl:.vhd
--regex-vhdl=/^[ \t]*package[ \t]+([^ ]+) is/\1/d,package declarations/i
--regex-vhdl=/^[ \t]*package[ \t]+body[ \t]+([^ ]+) is/\1/b,package bodies/i
--regex-vhdl=/^[ \t]*architecture[ \t]+([^ ]+) of/\1/a,architecture specifications/i
--regex-vhdl=/^[ \t]*entity[ \t]+([^ ]+) is/\1/e,entities/i
--regex-vhdl=/^[ \t]*([^ \t:]+)[ \t]*:[ \t]*process[ \t]*\(/\1/p,processes/i
--regex-vhdl=/^[ \t]*function[ \t]+([a-z0-9_]+)/\1/f,functions/i
--regex-vhdl=/^[ \t]*procedure[ \t]+([a-z0-9_]+)/\1/r,procedures/i
--regex-vhdl=/^[ \t]*type[ \t]+([^ ]+) is/\1/t,type declarations/i

他のヒント

I've added 'variable', 'signal' and :(in|out) for port definitions based on the original .ctags file you suggested. I found that matching those also is more convenient

--langdef=vhdl
--langmap=vhdl:.vhd;.VHD
--regex-vhdl=/^[ \t]*signal[ \t]*([^ ]+)/\1/s,signals/i
--regex-vhdl=/^[ \t]*([^ ]+)[ \t]*:[ \t]*(in|out)/\1/p,ports/i
--regex-vhdl=/^[ \t]*variable[ \t]*([^ ]+)/\1/v,variable/i
--regex-vhdl=/^[ \t]*package[ \t]+([^ ]+) is/\1/d,package declarations/i
--regex-vhdl=/^[ \t]*package[ \t]+body[ \t]+([^ ]+) is/\1/b,package bodies/i        
--regex-vhdl=/^[ \t]*architecture[ \t]+([^ ]+) of/\1/a,architecture specifications/i
--regex-vhdl=/^[ \t]*entity[ \t]+([^ ]+) is/\1/e,entities/i                 
--regex-vhdl=/^[ \t]*([^ \t:]+)[ \t]*:[ \t]*process[ \t]*\(/\1/p,processes/i
--regex-vhdl=/^[ \t]*function[ \t]+([a-z0-9_]+)/\1/f,functions/i  
--regex-vhdl=/^[ \t]*procedure[ \t]+([a-z0-9_]+)/\1/r,procedures/i
--regex-vhdl=/^[ \t]*type[ \t]+([^ ]+) is/\1/t,type declarations/i

Ctags is fundamentally broken, as it does not take into account scoping and overloading of names in VHDL. Just don't use it.

You can find more info in this blog post.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top