aboutsummaryrefslogtreecommitdiff
path: root/install.sh
blob: 2bb99ac398253d5a1dead904440cc9001a0fde4b (plain)
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
#!/usr/bin/env sh
# POSIX script for setting up VIM

set -eux

# Variables
script_name="$(basename "${0}")"
title='\033[1;36m'
red='\033[1;31m'
green='\033[1;32m'
reset='\033[0m'

readonly script_name title red green reset

clean_exit() {

    local status="${?}"

    if [ "${status}" != 0 ]; then
        printf "${red}%s (code: %s)${reset}\n" "VIM install failed" ${status}
    else
        printf  "${green}%s${reset}\n" "VIM install succeed"
    fi
}

trap clean_exit EXIT

# Ask if user want to copy the project in ~/.vim, can be skipped by adding
# ./install.sh any_argument_you_want
if [ "$#" -eq 0 ]; then
	printf "${title}Do you want to copy VIM config in ~/.vim ? [N/y]${reset}\n"
	read -r choice
	case "$choice" in
		y|Y)
			cp -r . ~/.vim
			printf "${green}%s${reset}\n" "VIM config copied in ~/.vim"
			;;
		*)
			;;
	esac
fi

sed -i s#\.config\/vim#\.vim## ~/.vim/conf/plugins.vim
sed -i s#\.config\/vim#\.vim## ~/.vim/vimrc
ArKa projects. All rights to me, and your next child right arm.