forked from aminzai/vimrc
-
Notifications
You must be signed in to change notification settings - Fork 16
/
Makefile
79 lines (60 loc) · 1.95 KB
/
Makefile
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
79
# =============================================================================
# Author: Chu-Siang Lai / chusiang (at) drx.tw
# Blog: http://note.drx.tw
# Filename: Makefile
# Modified: 2019-07-25 00:12
# Description: Install this with Make.
# Reference: https://github.com/chusiang/vimrc/blob/master/Makefile
# =============================================================================
.PHONY: all main backup install update clean clean-backup-file check \
yaml_check travis_check
TIMESTAMP=`date "+%Y-%m-%d-%H:%M:%S"`
FILE_VIMRC=${HOME}/.vimrc
FILE_GVIMRC=${HOME}/.gvimrc
DIR_VIM=${HOME}/.vim
DIR_VIM_BAK=${HOME}/.vim.bak-${TIMESTAMP}
DEIN_TARGET=~/.vim/bundle/repos/github.com/Shougo/dein.vim
main: update
all: backup install
backup:
@echo '==> Backup original vimrc ...'
mkdir ${DIR_VIM_BAK}
mv ${FILE_VIMRC} ${DIR_VIM_BAK}/
mv ${FILE_GVIMRC} ${DIR_VIM_BAK}/
mv ${DIR_VIM} ${DIR_VIM_BAK}/
@echo '==> Backup setting success.'
install:
@echo '==> Copy vimrc ...'
cat _vimrc > ${FILE_VIMRC}
cat _gvimrc > ${FILE_GVIMRC}
mkdir -p ${DIR_VIM}/
cp -r _vim/* ${DIR_VIM}/
@echo '==> Install dein.vim ...'
ifneq ("$(wildcard ${DEIN_TARGET})","")
# Target of "${DEIN_TARGET}" is exist, ignore ...
else
mkdir -p ${DEIN_TARGET}
git clone https://github.com/Shougo/dein.vim ${DEIN_TARGET}
endif
@echo '==> Install plugins ...'
vim -c "try | call dein#install() | finally | qall! | endtry" -Ne
@echo '==> Done.'
update:
@echo '==> Update plugins ...'
vim -c "try | call dein#update() | finally | qall! | endtry" -Ne
@echo '==> Done.'
clean: clean-backup-file
@echo "==> Starting cleaning vim file ..."
rm -f ${HOME}/.gvimrc
rm -f ${HOME}/.vimrc
rm -rf ${HOME}/.vim/
@echo '==> Done.'
clean-backup-file:
@echo "==> Starting cleaning vim's backup file ..."
rm -rf ${HOME}/.vim_bak*
@echo '==> Done.'
check: yaml_check travis_check
yaml_check:
find -name "*.yml" -type f -exec yamllint {} \;
travis_check:
travis lint .travis.yml