vim + Cscope + YouCompleteMe 实现自动补全与函数查找跳转

一、YouCompleteMe安装 (使用 vim-addon-manager 方式安装,方便简单!!!):
https://blog.csdn.net/sanoseiichirou/article/details/53791317
https://blog.csdn.net/tianminggenie/article/details/82899498
https://blog.csdn.net/lyh__521/article/details/46295775

二、vim+cscope+ctags:
https://blog.csdn.net/qq_26671365/article/details/78871835
https://blog.csdn.net/dengxiayehu/article/details/6330200
https://blog.csdn.net/rikeyone/article/details/82586733
https://blog.csdn.net/weixin_42182073/article/details/80380026
https://blog.csdn.net/laviolette/article/details/51364461

 

#!/bin/bash
DIR=`pwd`
update=1
change=0
while getopts "d:uc" opt;
do
    case $opt in
        d)
            DIR=$OPTARG
			;;
		u)
			update=1
			;;
		c)
			change=1
			;;
		?)
			echo "invaild option!"
			exit 1
	esac
done
 
cd ${DIR}
 
if [ 1 -eq ${change} ]; then
	echo "change project cscope database!"
	res=$(find ${DIR} -name cscope.out)
	if [ "x"${res} = "x" ]; then
		echo "Not found cscope database, generate cscope database!"
        find ${DIR} -name "*.h" -o -name "*.c" -o -name "*.cc" -o -name "*.cpp" -o -name "*.hh" > cscope.files
		cscope -bkq -i cscope.files 
        ctags -R --c++-kinds=+p --fields=+iaS --extra=+q *
		export CSCOPE_DB=${DIR}/cscope.out
	else
		echo "Found cscope database:${res}, just change CSCOPE_DB env!"
		export CSCOPE_DB=${res}
	fi
elif [ 1 -eq ${update} ]; then
	echo "udpate project cscope database!"
    find ${DIR} -name "*.h" -o -name "*.c" -o -name "*.cc" -o -name "*.cpp" -o -name "*.hh" > cscope.files
	cscope -bkq -i cscope.files
    ctags -R --c++-kinds=+p --fields=+iaS --extra=+q *
	export CSCOPE_DB=${DIR}/cscope.out
fi
 
echo CSCOPE_DB_PATH=${CSCOPE_DB}

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值