-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
101 lines (76 loc) · 2.61 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
.PHONY: all vim-all vim vim-only vim-clean tmux zsh etc babun
.DEFAULT_GOAL := help
define PRINT_HELP_PYSCRIPT
import re, sys
for line in sys.stdin:
match = re.match(r'^([a-zA-Z_-]+):.*?## (.*)$$', line)
if match:
target, help = match.groups()
print("%-20s %s" % (target, help))
endef
export PRINT_HELP_PYSCRIPT
SHELL:=/bin/bash
current_dir = $(shell pwd)
tmux_plugin_manager_path = $(shell source $(current_dir)/configs.sh; echo "$$tmux_plugin_manager_path")
# plugin_vimrc_path = "$(current_dir)/vim/plugins"
vim_plugin_path = "$(HOME)/.vim"
dotfiles_backup_path = "$(HOME)/.dotfiles-backup"
# zgen_init_path = "$(HOME)"/.zgen/init.zsh
test:
echo $(test_var)
help:
@python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)
backup:
mkdir -p $(dotfiles_backup_path)
cp .vimrc* $(dotfiles_backup_path)
cp .zshrc* $(dotfiles_backup_path)
cp .tmux.conf* $(dotfiles_backup_path)
all: vim-all tmux zsh etc ## Install all (vim, tmux, zsh and their configs)
vim-all: vim-only vim-install-vimplug ## Install .vimrc, local .vimrc and all plugins
@echo install vim-rest
mkdir -p $(vim_plugin_path)
ln -sf $(current_dir)/vim/.vimrc.plug.local $(HOME)
ln -sf $(current_dir)/vim/.vimrc.keys.local $(HOME)
ln -sf $(current_dir)/vim/.vimrc.local $(HOME)
$(MAKE) vim-install-plugins
# tmux-all: tmux tmux-rest ## Install .tmuxconf and all Tmux Plugins
# zsh-all: zsh zsh-rest ## Install oh-my-zsh and their configs
### START VIM SECTION
vim: vim-only vim-install-vimplug vim-install-plugins ## Install .vimrc with some useful plugins
vim-only: ## Install only .vimrc
@echo install vim
ln -sf $(current_dir)/vim/.vimrc $(HOME)
vim-install-plugins:
vim +PlugInstall +qall # Install plugins by Vim Plug
vim-install-vimplug:
$(current_dir)/init_vim.sh
vim-clean: ## Clean all vimrc and their plugins
rm -rIv $(HOME)/.vimrc* $(HOME)/.vim
### END VIM SECTION
tmux: ## Install .tmux.conf
@echo install tmux
$(current_dir)/init_tmux.sh
ln -sf $(current_dir)/tmux/.tmux.conf $(HOME)
tmux source ~/.tmux.conf
tmux-clean: ## Clean Tmux
rm -rIv $(HOME)/.tmux.conf* $(tmux_plugin_manager_path)
zsh: ## Install .zshrcs
@echo install zsh
ln -sf $(current_dir)/zsh/.zshrc $(HOME)
ln -sf $(current_dir)/zsh/.zshrc.zgen $(HOME)
ln -sf $(current_dir)/zsh/.zshrc.local $(HOME)
git submodule update --init --recursive
# $(MAKE) zsh-reload-rc
# zsh-all: zsh
# @echo install zsh-rest
# zsh
# $(MAKE) zsh-reload-rc
# zsh-reload-rc:
# rm -f $(zgen_init_path)
# source $(HOME)/.zshrc
zsh-clean: ## Clean zsh
rm -rfv $(HOME)/.zshrc* $(HOME)/.zgen
babun: ## Install babunrc and their rcs.
ln -sf $(current_dir)/babun/.minttyrc $(HOME)
etc:
@echo install etc