zoukankan      html  css  js  c++  java
  • vim设置成类source insight功能,实现跳转和查找

            高版本的内核代码有脚本可以生成索引,通过vim看代码过程可以实现跳转,具备基本的source insight功能。

    1. cd到kernel所在目录,执行如下脚本,生成源码的索引文件
    生成ctags的索引文件
    [root@localhost]# ./scripts/tags.sh tags

    生成cscope的索引文件
    [root@localhost]# ./scripts/tags.sh cscope

    2. vim 中添加索引文件
    随便打开工程下面的一个文件
    添加ctags的索引文件:
    :set tags=内核代码的目录/tags

    添加cscope索引文件:
    :cs add 内核代码的目录/cscope.out

    3. vim 打开内核的文件,即可跳转
    ctags的方法: 光标移动到待跳转的单词上, 按ctrl + ] 即可跳转过去,按ctrl + o 可跳回来;
    cscope的方法: vim 敲 :cs help 查找帮助
    常用的如下几个:
    Find this C symbol:                             cs find s XXX
    Find this file:                                       cs find f XXX
    Find functions called by this function: cs find d XXX
    Find functions calling this function:     cs find c xxx

           低版本的内核(比如linux-2.4)可能没有scripts/tags.sh这个文件,可以把高版本的scripts/tags.sh脚本
    拷贝到低版本内核中,一样有效果!

  • 相关阅读:
    [CF845G]Shortest Path Problem?
    [洛谷P4149][IOI2011]Race
    [洛谷P4178]Tree
    [AtCoder AGC27A]Candy Distribution Again
    [洛谷P3806]【模板】点分治1
    [洛谷P2634][国家集训队]聪聪可可
    [CF280C]Game on Tree
    [洛谷P3338][ZJOI2014]力
    [CF438D]The Child and Sequence
    [CF609E]Minimum spanning tree for each edge
  • 原文地址:https://www.cnblogs.com/samdyhc/p/9301663.html
Copyright © 2011-2022 走看看