-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathcatvimrc.sh
More file actions
executable file
·34 lines (29 loc) · 1013 Bytes
/
catvimrc.sh
File metadata and controls
executable file
·34 lines (29 loc) · 1013 Bytes
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
33
34
#!/bin/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
else
sed -n '/GAME_TEAM_VJ/ {s///; :a; n; p; ba; }' ~/.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