如何忽略vim中的标签文件错误

时间:2021-01-19 17:27:38

For some reason I have errors in tags file generated by ctags. Have tried to solve the errors by changing ctags options, did no good. Now I would like to try another approach - make vim ignore errors in the tags file. Is it possible? The tags file contains lines that are not tags, just sentences taken from somewhere in the code, I guess. The tag file is quite large:

出于某种原因,我在ctags生成的标签文件中有错误。试图通过改变ctags选项来解决错误,没有好处。现在我想尝试另一种方法 - 让vim忽略tags文件中的错误。可能吗?标签文件包含不是标签的行,我想是从代码中的某个地方取的句子。标签文件非常大:

$ wc tags
591708  3711802 65594557 tags

e.g.:

例如。:

$grep -vn -C 1 "\/" tags
510630-packet   ISS/code/opensource/ssl/ssl.h   /^  unsigned char *packet;$/;"  m   struct:ssl_st
510631:packet that is present on the network wire. Even if an inbound packet is denied
510632-packetSrcAdr ISS/code/future/ospf/inc/osfssnmp.h /^    tIPADDR    packetSrcAdr;$/;"  m   struct:_IfConfErrTrapInfo

found out that there is a faq.tex file that many 'sentences' come from it. I'm trying to exclude it from ctags (--exclude)

发现有一个faq.tex文件,很多“句子”来自它。我试图将它从ctags(--exclude)中排除

2 个解决方案

#1


0  

If the corrupted lines in the tags file match some pattern (regex), you could fix-up the tags file. e.g. place this in your Makefile:

如果标记文件中的损坏行与某些模式(正则表达式)匹配,则可以修复标记文件。例如将它放在Makefile中:

tags:
     ctags -f $@.tmp ...
     grep -v 'pattern of bogus tag lines' $@.tmp > $@
     rm $@.tmp

#2


0  

The best solution is to look for the origin of the lines with the error and try to eliminate those lines / files, causing the errors in the tags file.

最好的解决方案是查找带有错误的行的来源,并尝试消除这些行/文件,从而导致标记文件中的错误。

#1


0  

If the corrupted lines in the tags file match some pattern (regex), you could fix-up the tags file. e.g. place this in your Makefile:

如果标记文件中的损坏行与某些模式(正则表达式)匹配,则可以修复标记文件。例如将它放在Makefile中:

tags:
     ctags -f $@.tmp ...
     grep -v 'pattern of bogus tag lines' $@.tmp > $@
     rm $@.tmp

#2


0  

The best solution is to look for the origin of the lines with the error and try to eliminate those lines / files, causing the errors in the tags file.

最好的解决方案是查找带有错误的行的来源,并尝试消除这些行/文件,从而导致标记文件中的错误。