-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathinit.sh
executable file
·78 lines (68 loc) · 1.3 KB
/
init.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/bin/sh
RCFILES="
.bashrc
.zshrc
.cshrc
.tcshrc
"
EMACSEN="
emacs
xemacs
mule
nemacs
mg
"
VI="
vim
nvi
jelvis
elvis
vi
ex
ed
"
echo "powerup your emacs."
POWERFUL_EDITOR='cat >/dev/null'
for pe in $VI;
do
if type $pe 2>/dev/null | grep 'is /' >/dev/null 2>&1;
then
POWERFUL_EDITOR=$pe
break
fi
done
for FILE in ${RCFILES};
do
if [ -e ~/${FILE} ]; then
{
echo ""
echo "#===================="
echo "# powerup your emacs "
echo "#===================="
if [ ${FILE} = ".cshrc" -o ${FILE} = ".tcshrc" ]; then
for e in $EMACSEN;
do
echo "alias $e '$POWERFUL_EDITOR'"
done
else
for e in $EMACSEN;
do
echo "alias $e='$POWERFUL_EDITOR'"
done
fi
} >> ~/${FILE}
fi
done
if [ -f /etc/yum.conf ];then
echo "exclude=emacs" | sudo tee -a /etc/yum.conf > /dev/null
fi
if [ -d /etc/apt/preferences.d ];then
echo "Package: emacs\nPin: release v=*\nPin-Priority: -1\n" | sudo tee -a /etc/apt/preferences.d/powerful-editor.pref > /dev/null
fi
echo "enjoy your emacs life!"
# Local Variables:
# mode: sh
# sh-basic-offset: 4
# tab-width: 4
# coding: utf-8
# End: