cscope + vim tips

cscope related setting(.vimrc.local) as below:
================================

" cscope setting
if has("cscope") && filereadable("/usr/bin/cscope")
   set csprg=/usr/bin/cscope
   set csto=0
   set cst
   set nocsverb
   " add any database in current directory
   if filereadable("cscope.out")
      cs add cscope.out
   " else add database pointed to by environment
   endif

   if filereadable("/tmp/kern.load") && $CSCOPE_KERN != ""
        if matchstr($PWD, "linux-source-5.0.0") != ""                                                           
               " do nothing

        else
            echo "cs add kern cscope"
            cs add $CSCOPE_KERN
        endif
   endif

   if filereadable("/tmp/uboot.load") && $CSCOPE_UBOOT != ""
      cs add $CSCOPE_UBOOT
   endif

   set csverb
endif

" cscope shortcut
nmap <C-_>s :cs find s <C-R>=expand("<cword>")<CR><CR>
nmap <C-_>g :cs find g <C-R>=expand("<cword>")<CR><CR>
nmap <C-_>c :cs find c <C-R>=expand("<cword>")<CR><CR>
nmap <C-_>t :cs find t <C-R>=expand("<cword>")<CR><CR>
nmap <C-_>e :cs find e <C-R>=expand("<cword>")<CR><CR>
nmap <C-_>f :cs find f <C-R>=expand("<cfile>")<CR><CR>
nmap <C-_>i :cs find i <C-R>=expand("<cfile>")<CR><CR>
nmap <C-_>d :cs find d <C-R>=expand("<cword>")<CR><CR>

 

==========================================================================

cscope_cur.sh >>>

 

#!/bin/sh

echo "current path:  $PWD"

find $PWD -name "*.[chxsS]" -print > cscope.files

cscope -bkq -i cscope.files
 

--------------------------------------------------------------------------------------------

 

cscope_linux.sh >>>

 

LNX=$PWD

cd $PWD

find  $LNX                                                                \
-path "$LNX/arch/*" ! -path "$LNX/arch/i386*" -prune -o               \
-path "$LNX/include/asm-*" ! -path "$LNX/include/asm-i386*" -prune -o \
-path "$LNX/tmp*" -prune -o                                           \
-path "$LNX/Documentation*" -prune -o                                 \
-path "$LNX/scripts*" -prune -o                                       \
-path "$LNX/drivers*" -prune -o                                       \
    -name "*.[chxsS]" -print > cscope.files

find $LNX/drivers -maxdepth 4 -name "*.[chxsS]" >> cscope.files


cscope -bkq -i cscope.files

cd -
 

-----------------------------------------------------------------------------------------------

cscope_uboot.sh >>>

 

UBOOT=$PWD

cd $PWD

find  $UBOOT                                                                \
-path "$UBOOT/arch/*" ! -path "$UBOOT/arch/i386*" -prune -o               \
-path "$UBOOT/include/asm-*" ! -path "$UBOOT/include/asm-i386*" -prune -o \
-path "$UBOOT/tmp*" -prune -o                                           \
-path "$UBOOT/Documentation*" -prune -o                                 \
-path "$UBOOT/scripts*" -prune -o                                       \
-path "$UBOOT/drivers*" -prune -o                                       \
    -name "*.[chxsS]" -print > cscope.files

cscope -bkq -i cscope.files

cd -

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值