-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsettings.sh
More file actions
executable file
·51 lines (47 loc) · 1.21 KB
/
settings.sh
File metadata and controls
executable file
·51 lines (47 loc) · 1.21 KB
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
### Linux & MacOS Setting script ###
print_help() {
echo -e "Usage: $0 [linux/mac] [up/down]"
exit 0
}
# Print usage help.
if [[ "$#" -lt 1 || $1 = '-h' || $1 = '--help' ]]; then
print_help
fi
##### Default arguments #####
# linux or mac
os=$1; shift
if [[ $os != 'linux' && $os != 'mac' ]]; then
echo -e "Error: unknown OS $os"
print_help
fi
if [[ $os = 'linux' ]]; then
ud=$1; shift
# upload
if [[ $ud = 'up' ]]; then
cat ~/.vimrc > ./linux_mac_settings/vim/my_vimrc.txt;
cat ~/.vim/bundle/YouCompleteMe/.ycm_extra_conf.py > ./linux_mac_settings/vim/linux_ycm_extra_conf.py;
git add .;
git commit -m 'upload settings';
git push origin master
# download
elif [[ $ud = 'down' ]]; then
cat ./linux_mac_settings/vim/my_vimrc.txt > ~/.vimrc
else
print_help
fi
elif [[ $os = 'mac' ]]; then
ud=$1; shift
# upload
if [[ $ud = 'up' ]]; then
cat ~/.vimrc > ./linux_mac_settings/vim/my_vimrc.txt;
cat ~/.vim/bundle/YouCompleteMe/.ycm_extra_conf.py > ./linux_mac_settings/vim/mac_ycm_extra_conf.py;
git add .;
git commit -m 'upload settings';
git push origin master
# download
elif [[ $ud = 'down' ]]; then
cat ./linux_mac_settings/vim/my_vimrc.txt > ~/.vimrc
else
print_help
fi
fi