Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VHDL tags not efficient in vim with ctags+taglist

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.

like image 284
Bamban Avatar asked Jan 29 '26 02:01

Bamban


2 Answers

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
like image 76
Dylan MacKenzie Avatar answered Feb 01 '26 03:02

Dylan MacKenzie


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
like image 32
pslavkin Avatar answered Feb 01 '26 03:02

pslavkin