forked from jessfraz/.vim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
52 lines (43 loc) · 1.96 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
XDG_CONFIG_HOME := $(HOME)/.config
.PHONY: install
install: ## Sets up symlink for user and root .vimrc for vim and neovim.
ln -snf "$(HOME)/.vim/vimrc" "$(HOME)/.vimrc"
mkdir -p "$(XDG_CONFIG_HOME)"
ln -snf "$(HOME)/.vim" "$(XDG_CONFIG_HOME)/nvim"
ln -snf "$(HOME)/.vimrc" "$(XDG_CONFIG_HOME)/nvim/init.vim"
sudo ln -snf "$(HOME)/.vim" /root/.vim
sudo ln -snf "$(HOME)/.vimrc" /root/.vimrc
sudo mkdir -p /root/.config
sudo ln -snf "$(HOME)/.vim" /root/.config/nvim
sudo ln -snf "$(HOME)/.vimrc" /root/.config/nvim/init.vim
.PHONY: update
update: update-pathogen update-plugins ## Updates pathogen and all plugins.
.PHONY: update-plugins
update-plugins: ## Updates all plugins.
git submodule update --init --recursive
git submodule foreach git pull --recurse-submodules origin master
.PHONY: update-pathogen
update-pathogen: ## Updates pathogen.
curl -LSso $(CURDIR)/autoload/pathogen.vim https://raw.githubusercontent.com/tpope/vim-pathogen/master/autoload/pathogen.vim
.PHONY: README.md
README.md: ## Generates and updates plugin info in README.md.
@sed -i '/Dockerfile/q' $@
@git submodule --quiet foreach bash -c "echo -e \"* [\$$(git config --get remote.origin.url | sed 's#https://##' | sed 's#git://##' | sed 's/.git//')](\$$(git config --get remote.origin.url))\"" >> $@
check_defined = \
$(strip $(foreach 1,$1, \
$(call __check_defined,$1,$(strip $(value 2)))))
__check_defined = \
$(if $(value $1),, \
$(error Undefined $1$(if $2, ($2))$(if $(value @), \
required by target `$@')))
.PHONY: remove-submodule
remove-submodule: ## Removes a git submodule (ex MODULE=bundle/nginx.vim).
@:$(call check_defined, MODULE, path of module to remove)
mv $(MODULE) $(MODULE).tmp
git submodule deinit -f -- $(MODULE)
$(RM) -r .git/modules/$(MODULE)
git rm -f $(MODULE)
$(RM) -r $(MODULE).tmp
.PHONY: help
help:
@grep -E '^[a-zA-Z_-.]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'