码迷,mamicode.com
首页 > 其他好文 > 详细

svtag supported by ctags

时间:2017-07-10 10:37:16      阅读:184      评论:0      收藏:0      [点我收藏+]

标签:tput   isp   signed   function   auto   ctags   input   parameter   for   


编辑 ~/.ctags, 添加以下代码:
--exclude=.SOS
--exclude=.git
--exclude=nobackup
--exclude=nobkp
--exclude=results
--exclude=*.log

--langdef=SystemVerilog
--langmap=SystemVerilog:.sv.v.svh.tv.vg.vinc

--regex-SystemVerilog=/^\s*(\b(static|local|virtual|protected)\b)*\s*\bclass\b\s*(\b\w+\b)/\3/c,class/
--regex-SystemVerilog=/^\s*(\b(static|local|virtual|protected)\b)*\s*\btask\b\s*(\b(static|automatic)\b)*\s*(\w+::)*\s*(\b\w+\b)/\6/t,task/
--regex-SystemVerilog=/^\s*(\b(static|local|virtual|protected)\b)*\s*\bfunction\b\s*(\b(\w+)\b)*\s*(\w+::)*\s*(\b\w+\b)/\6/f,function/

--regex-SystemVerilog=/^\s*\bmodule\b\s*(\b\w+\b)/\1/m,module/
--regex-SystemVerilog=/^\s*\bprogram\b\s*(\b\w+\b)/\1/p,program/
--regex-SystemVerilog=/^\s*\binterface\b\s*(\b\w+\b)/\1/i,interface/
--regex-SystemVerilog=/^\s*\btypedef\b\s+.*\s+(\b\w+\b)\s*;/\1/e,typedef/
--regex-SystemVerilog=/^\s*`define\b\s*(\w+)/`\1/d,define/
--regex-SystemVerilog=/}\s*(\b\w+\b)\s*;/\1/e,typedef/

--regex-SystemVerilog=/^\s*(\b(static|local|private|rand)\b)*\s*(\b(shortint|int|longint)\b)\s*(\bunsigned\b)?(\s*\[.+\])*\s*(\b\w+\b)/\7/v,variable/
--regex-SystemVerilog=/^\s*(\b(static|local|private|rand)\b)*\s*(\b(byte|bit|logic|reg|integer|time)\b)(\s*\[.+\])*\s*(\b\w+\b)/\6/v,variable/
--regex-SystemVerilog=/^\s*(\b(static|local|private)\b)*\s*(\b(real|shortreal|chandle|string|event)\b)(\s*\[.+\])*\s*(\b\w+\b)/\6/v,variable/
--regex-SystemVerilog=/(\b(input|output|inout)\b)?\s*(\[.+\])*\s*(\b(wire|reg|logic)\b)\s*(\[.+\])*\s*(#(\(.+\)|\S+)\))?\s*(\b\w+\b)/\9/v,variable/
--regex-SystemVerilog=/(\b(parameter|localparam)\b).+(\b\w+\b)\s*=/\3/a,parameter/

--SystemVerilog-kinds=+ctfmpied

--languages=SystemVerilog,C,C++,HTML,Lisp,Make,Perl,Python,Sh
然后就可以运行 ctags 产生 TAGS 文件: ctags -Re --languages=SystemVerilog -f my.tags /path/to/your/source/code
之后配置 VIM, 使 VIM 能读到已经产生的 TAGS 文件:
以后在 VIM 中打开代码时,就可以通过 CTRL-] 跳转到当前光标处的变量/函数等的定义位置。
在module和endmodule间跳转
在 VIM 中,可以通过 % 在匹配的 ( 与 ) ,{ 与 } , [ 与 ] 间跳转。增加以下配置后,可以实现在 module 与 endmodule,task 与 endtask等之间跳转。
runtime! macros/matchit.vim
if exists(‘loaded_matchit‘)
let b:match_ignorecase=0
let b:match_words=
\ ‘\<begin\>:\<end\>,‘ .
\ ‘\<if\>:\<else\>,‘ .
\ ‘\<module\>:\<endmodule\>,‘ .
\ ‘\<class\>:\<endclass\>,‘ .
\ ‘\<program\>:\<endprogram\>,‘ .
\ ‘\<clocking\>:\<endclocking\>,‘ .
\ ‘\<property\>:\<endproperty\>,‘ .
\ ‘\<sequence\>:\<endsequence\>,‘ .
\ ‘\<package\>:\<endpackage\>,‘ .
\ ‘\<covergroup\>:\<endgroup\>,‘ .
\ ‘\<primitive\>:\<endprimitive\>,‘ .
\ ‘\<specify\>:\<endspecify\>,‘ .
\ ‘\<generate\>:\<endgenerate\>,‘ .
\ ‘\<interface\>:\<endinterface\>,‘ .
\ ‘\<function\>:\<endfunction\>,‘ .
\ ‘\<task\>:\<endtask\>,‘ .
\ ‘\<case\>\|\<casex\>\|\<casez\>:\<endcase\>,‘ .
\ ‘\<fork\>:\<join\>\|\<join_any\>\|\<join_none\>,‘ .
\ ‘`ifdef\>:`else\>:`endif\>,‘
endif

svtag supported by ctags

标签:tput   isp   signed   function   auto   ctags   input   parameter   for   

原文地址:http://www.cnblogs.com/bky-lxin/p/7144248.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!