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 -