forked from bemobi/vim
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
112 lines (87 loc) · 2.56 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
.SUFFIXES:
VIM_DIR := $(HOME)/.vim
VIMRC := $(HOME)/.vimrc
AUTOLOAD := $(VIM_DIR)/autoload
PLUGGED := $(VIM_DIR)/plugged
VIM_PLUG := $(AUTOLOAD)/plug.vim
BASE := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
SRC := $(BASE)/src
COC_EXTENSIONS := $(shell paste -sd' ' $(SRC)/coc.extensions)
PIP3 := $(shell command -v pip3 2> /dev/null)
ifndef PIP3
define MSG
PIP3 does not seem to be installed.
To install it, follow the instructions found at this website:
https://pip.pypa.io/en/stable/installing/
endef
$(error $(MSG))
endif
NVIM_DIR := $(HOME)/.config/nvim
NVIM_INIT := $(NVIM_DIR)/init.vim
NVIM := $(shell command -v nvim 2> /dev/null)
VIM := vim
ifdef NVIM
VIM := nvim
endif
PY3_NEOVIM := $(shell pip3 list | grep neovim 2> /dev/null)
ifdef NVIM
ifndef PY3_NEOVIM
define MSG
You have NEOVIM installed, but the Python module is not installed
Try installing it with the following command:
sudo -H pip3 install neovim
endef
$(error $(MSG))
endif
endif
.PHONY: install
install: basic
@echo set runtimepath+="$(VIM_DIR)" > "$(VIMRC)"
@cat $(SRC)/basic.vim >> "$(VIMRC)"
@cat $(SRC)/basic-*.vim >> "$(VIMRC)"
@echo "call plug#begin('$(PLUGGED)')" >> "$(VIMRC)"
@cat $(SRC)/plug.vim >> "$(VIMRC)"
@echo 'call plug#end()' >> "$(VIMRC)"
@cat $(SRC)/plug-*.vim >> "$(VIMRC)"
@cat $(SRC)/theme-*.vim >> "$(VIMRC)"
@cat $(SRC)/local.vim >> "$(VIMRC)"
.PHONY: basic
basic: basic-vimrc vim-plug plugins | $(VIM_DIR)
.PHONY: basic-vimrc
basic-vimrc:
@echo set runtimepath+="$(VIM_DIR)" > "$(VIMRC)"
@cat $(SRC)/basic.vim >> "$(VIMRC)"
@cat $(SRC)/basic-*.vim >> "$(VIMRC)"
@echo "call plug#begin('$(PLUGGED)')" >> "$(VIMRC)"
@cat $(SRC)/plug.vim >> "$(VIMRC)"
@echo 'call plug#end()' >> "$(VIMRC)"
.PHONY: vim-plug
vim-plug:
@[ -f $(VIM_PLUG) ] || \
curl -sfLo $(VIM_PLUG) --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
@mkdir -p $(PLUGGED)
.PHONY: plugins
plugins:
ifdef NVIM
@mkdir -p $(NVIM_DIR)
@echo "let vimrc=expand(\"$(VIMRC)\")" > "$(NVIM_INIT)"
@echo 'if filereadable(vimrc)' >> $(NVIM_INIT)
@echo ' exec ":source " . vimrc' >> $(NVIM_INIT)
@echo 'endif' >> $(NVIM_INIT)
endif
@cp $(SRC)/coc-settings.json $(NVIM_DIR)/coc-settings.json
@$(VIM) +PlugClean +PlugInstall +UpdateRemotePlugins +qall
@$(VIM) +GoInstallBinaries +qall
@$(VIM) '+CocInstall -sync $(COC_EXTENSIONS)' +qall
$(VIM_DIR):
@mkdir -p $(VIM_DIR)
.PHONY: clean
clean:
@rm -rf $(VIM_DIR) $(VIMRC) $(NVIM_INIT)
.PHONY: plug-update
plug-update:
@vim +PlugUpdate +UpdateRemotePlugins +qall
.PHONY: deps
deps:
@brew install borkdude/brew/clj-kondo