博文

目前显示的是标签为“vi”的博文

VI改造计划补充篇

在《VI改造计划》一文中讲述到了ctags和cscope两个工具,在使用Linux Kernel源码进行实操时需要使用:cs add cscope.out去加载cscope数据库,每次这样操作会让我们抓狂,那我们修改下~/.vimrc吧,在该文件里加入如下内容: if filereadable("cscope.out") cs add cscope.out endif 这样以后进入Kernel源码打开文件后就可以直接使用:cs f g start_kernel等查找语句了。  关于ctags,我们在vim的normal模式下使用:tag tagname查找定位tag时可能有好几个,那么我们还可以使用如下指令来定位: :tfirst    跳转到第一个 :tnext    跳转到下一个 :tlast     跳转到最后一个  关于cscope,我们使用:cs help可以看到如下帮助信息: cscope commands: add : Add a new database (Usage: add file|dir [pre-path] [flags]) find : Query for a pattern (Usage: find c|d|e|f|g|i|s|t name) c: Find functions calling this function d: Find functions called by this function e: Find this egrep pattern f: Find this file g: Find this definition i: Find files #including this file s: Find this C symbol t: Find this text string help : Show this message (Usage: help) kill : Kill a connection (Usage: kill #) reset: Reinit all connections (Usage: reset) show : Show connections (Usage: show) 其大概翻译如下: ...