ctags - 更新大型项目中刚刚修改的文件的 cscope db 和 ctags

标签 ctags cscope

假设我的 c 项目 中有大约 100000 个 *.c *.h 文件。我使用 find 命令将其列出到 cscope.files 中,然后从中创建 cscope.out 和标记文件,如下所示。

1. find `pwd` -type f \( -name "*.c" -o -name "*.h" \) > cscope.files
2. /usr/bin/ctags -L cscope.files
3. cscope -b -i cscope.files -f cscope.out

完成此操作需要 25 - 30 分钟的时间。如果我修改单个 c 文件,那么如果我想更新 ctags,则需要大约 20 分钟,因为我正在更新整个 c 项目(即步骤 2,3)。那么有没有什么方法可以通过更新更改的 c 文件来更快地更新 cscope.out 和标签文件。

最佳答案

您可以使用 ctags 为一组文件生成标签(修改时间大于 .tags 修改时间),并使用 --append 开关将结果附加到当前现有标签:

ctags --recurse --verbose --append --extra=+q --fields=+aimS --c-kinds=+p --c++-kinds=+p -L list_of_files

更多信息:https://gist.github.com/Flolagale/5195934

关于ctags - 更新大型项目中刚刚修改的文件的 cscope db 和 ctags,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37243426/

相关文章:

vim 使用 "cscope find s"命令并在新选项卡而不是窗口中打开结果

vim - 从 vim 更新 cscope 数据库

windows - 不能在 gvim (windows) 中将 CTRL-<Space> 与 Cscope 插件一起使用

vim - 为什么不能在 ctags 命令中使用排除参数排除文件?

bash - Golang exec.Command 多个管道

vim - 如何以递归方式创建 ctags 文件?

vim - 如何配置 ctags 以使用 CSS、SCSS、HTML?

ctags - 从命令行使用 ctags 或 cscope(无交互模式)

ctags错误 "format error in tags file"

python - 让 Vim 了解 python 的 ctag 类型注释