-
Notifications
You must be signed in to change notification settings - Fork 2
/
catvimrc.sh
executable file
·32 lines (27 loc) · 926 Bytes
/
catvimrc.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env bash
source $(dirname $0)/config.sh
# OLD_VIMRC=/home/q/tools/game_team/vim/runtime/_vimrc
BASEDIR=$(cd $(dirname $BASH_SOURCE);pwd)
temp_vimrc="/tmp/temp_vimrc"
if [[ ~/.vimrc -ef $OLD_VIMRC || "$1" = '-f' ]]; then
touch new_vimrc > $temp_vimrc
rm -rf new_vimrc
rm -rf ~/.vimrc
elif [[ -h ~/.vimrc ]]; then
LVIMRC=`readlink ~/.vimrc`
rm -rf ~/.vimrc
echo -e "if filereadable(expand('$LVIMRC'))\n exec 'source $LVIMRC'\nendif" > $temp_vimrc
elif [[ -f ~/.vimrc ]]; then
SED_RESULT=`sed -n '/GAME_TEAM_VJ/p' ~/.vimrc`
if [[ -z "$SED_RESULT" ]]; then
cat ~/.vimrc > $temp_vimrc
fi
else
touch new_vimrc > $temp_vimrc
rm -f new_vimrc
fi
echo -e '" ---------------------------------------------' > ~/.vimrc
echo -e "source $BASEDIR/.vimrc" >> ~/.vimrc
cat $(dirname $0)/_vimrc_head $temp_vimrc >> ~/.vimrc
echo -e "~/.vimrc已生成\n"
rm -rf $temp_vimrc