通过VIM搭建一个IDE,网上的文章有很多,这里就不献丑了。
下面记录下生成tags,cscope.out, cscope.files的脚本文件
一、windows版本(.bat)
del cscope.out cscope.files tags
echo del "cscope.out cscope.files tags" successful!echo "ctags create"
ctags --languages=c --langmap=c:+.h --extra=+q -Recho "cscope create"
dir /s /b *.c *.h > cscope.files
cscope -bCkR -i cscope.files
注意:
1. 执行上面的脚本前,请确保正确安装了ctags.exe和cscope.exe,并配置到了环境变量PATH下。
2. windows下生成的cscope.files中的路径是绝对路径
针对lvr的生成脚本:
@echo offgoto start1. 获取当前路径2. 得到cscope.files的全路径3. 删除原来生成的文件4. 将lib的源文件加入cscope.files5. 将lvr的源文件加入cscope.files6. 利用cscope建立索引数据库:startset curpath=%cd%
set csfile=%curpath%\cscope.filesdel tags cscope.out cscope.files
ctags --languages=c --langmap=c:+.h --extra=+q -Rset libpath=%curpath%\..\..\lib_new_gui
cd %libpath%\trunk\platform_x2
dir /s /b *.c *.h > %csfile%cd %curpath%
dir /s /b *.c *.h >> %csfile%cscope -bCkR -i %csfile% -I%libpath%
-----------------------------------------------------------------------------------------------------------------------------
二、Linux版本(.sh)
#!/bin/bash
echo "delete cscope.files, cscope.out, tags"
rm -f cscope.files cscope.out tagsecho "create cscope.files"
find . -name '*.h' -o -name '*.c' > cscope.filesecho "cscope add cscope.files"
cscope -bCkR -i cscope.filesecho "create tags"
ctags --languages=c --langmap=c:+.h --extra=+q -R
注意:
linux下生成的cscope.files中的路径是相对路径,由find后的路径决定,所以一般在vim的配置中不使用"set autochdir"!