Chinaunix首页 | 论坛 | 博客
  • 博客访问: 44564
  • 博文数量: 18
  • 博客积分: 390
  • 博客等级: 一等列兵
  • 技术积分: 215
  • 用 户 组: 普通用户
  • 注册时间: 2012-04-02 21:11
文章分类

全部博文(18)

文章存档

2012年(18)

我的朋友

分类: LINUX

2012-04-04 16:43:33

#!/bin/sh
#  filename:

# createproject.sh

#echo $HOME

if [ "$1" = "help" ] ; then
    echo "Usage:"
    echo "  createproject.sh [projectname]"
    exit 0
fi

if [ "$1" = "" ] ; then
    echo "please input your project-name"
    exit 1
fi

PROJECT=$1

CSCOPE_DIR=$HOME/.vim/prj_cscope
TAGS_DIR=$HOME/.vim/prj_tags
PLUGIN_DIR=$HOME/.vim/plugin

mkdir -p $CSCOPE_DIR
mkdir -p $TAGS_DIR
mkdir -p $PLUGIN_DIR


find $PWD -name "*.h" -o -name "*.c" -o -name "*.cc" > $CSCOPE_DIR/cscope.files
cscope -bkq -i $CSCOPE_DIR/cscope.files -f $CSCOPE_DIR/cscope_$PROJECT.out
#echo $PWD
ctags -f $TAGS_DIR/tag_$PROJECT -R $PWD --c++-kinds=+p --fields=+iaS --extra=+q

echo "set tags+=$TAGS_DIR/tag_$PROJECT" > $PLUGIN_DIR/prj_$PROJECT.vim

echo "if has(\"cscope\")" >> $PLUGIN_DIR/prj_$PROJECT.vim

echo "set csprg=/usr/bin/cscope" >> $PLUGIN_DIR/prj_$PROJECT.vim
echo "set csto=1" >> $PLUGIN_DIR/prj_$PROJECT.vim
echo "set cst" >> $PLUGIN_DIR/prj_$PROJECT.vim
echo "set nocsverb" >> $PLUGIN_DIR/prj_$PROJECT.vim
echo "if filereadable(\"$CSCOPE_DIR/cscope_$PROJECT.out\")" >> $PLUGIN_DIR/prj_$PROJECT.vim
echo "cs add $CSCOPE_DIR/cscope_$PROJECT.out" >> $PLUGIN_DIR/prj_$PROJECT.vim
echo "endif" >> $PLUGIN_DIR/prj_$PROJECT.vim
echo "set csverb" >> $PLUGIN_DIR/prj_$PROJECT.vim
echo "endif" >> $PLUGIN_DIR/prj_$PROJECT.vim

#############################################################################################

删除ctags, cscope.out的脚本:

#!/bin/sh
# filename:

# deleteproject.sh

#echo $HOME


if [ "$1" = "help" ] ; then
    echo "Usage:"
    echo "  deleteproject.sh [projectname]|[]"
    exit 0
fi


PROJECT=$1


CSCOPE_DIR=$HOME/.vim/prj_cscope
TAGS_DIR=$HOME/.vim/prj_tags
PLUGIN_DIR=$HOME/.vim/plugin


if [ "$PROJECT" = "" ] ; then
    rm -f $CSCOPE_DIR/*
    rm -f $TAGS_DIR/*
    rm -f $PLUGIN_DIR/prj_*.vim
else
    rm -f $CSCOPE_DIR/cscope_$PROJECT.out*
    rm -f $TAGS_DIR/tag_$PROJECT
    rm -f $PLUGIN_DIR/prj_$PROJECT.vim
fi
阅读(757) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~