-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall
executable file
·36 lines (29 loc) · 980 Bytes
/
install
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
#!/bin/bash
# Author: Uladzimir Khasianevich
# License: MIT License
vimdir=$HOME/.vim
[ ! -d $vimdir ] && echo "Error: $vimdir does not exist" 1>&2 && exit 1
script=$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )
ftdir=$vimdir/ftdetect
syndir=$vimdir/syntax
while getopts ":v:h" opt; do
case $opt in
v) ver=$OPTARG;;
h) hl="True";;
\?) echo "Usage: install [-v version] [-h]" 1>&2 && exit 1;;
:) echo "Invalid option: $OPTARG requires an argument" 1>&2 && exit 1
;;
esac
done
[ -z "$ver" ] && ver=7.0
[ -z "$hl" ] && hl="False"
[ ! -d $ftdir ] && echo "Creating $ftdir." && mkdir $ftdir
cp $script/ftdetect/wolf.vim $ftdir
[ ! -d $syndir ] && echo "Creating $syndir." && mkdir $syndir
read -r -d '' code <<EOF
AppendTo[\$Path, "$script"];
Needs["Vimwolf\`"];
Vimwolf\`SetVersion[$ver, $hl];
EOF
exeCommand=$(ls /usr/local/Wolfram/Mathematica/*/Executables/wolframscript | tail -n 1)
$exeCommand -code "$code"