-
Notifications
You must be signed in to change notification settings - Fork 469
/
Makefile
63 lines (53 loc) · 1.62 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
SHELL := /usr/bin/env bash
XDG_CACHE_HOME ?= $(HOME)/.cache
XDG_CONFIG_HOME ?= $(HOME)/.config
XDG_DATA_HOME ?= $(HOME)/.local/share
XDG_STATE_HOME ?= $(HOME)/.local/state
default: install
.PHONY: install update
install: create-dirs update-plugins
update: update-repo update-plugins
.PHONY: create-dirs
create-dirs:
@mkdir -vp "$(XDG_CONFIG_HOME)"/nvim/spell
@mkdir -vp "$(XDG_DATA_HOME)"/nvim
@mkdir -vp "$(XDG_STATE_HOME)"/nvim/{sessions,shada,swap,undo}
.PHONY: stash
stash:
git checkout -- lazy-lock.json
git stash -a
.PHONY: update-repo
update-repo:
git pull --ff --ff-only
.PHONY: update-plugins
update-plugins:
nvim --headless '+Lazy! sync' +qa
@echo
.PHONY: uninstall
uninstall:
-rm -rf "$(XDG_DATA_HOME)"/nvim/{lazy,mason,rplugin.vim}
-rm -rf "$(XDG_STATE_HOME)"/nvim/{lazy,shada,swap,undo,theme.txt}
-rm -rf "$(XDG_CACHE_HOME)"/nvim/{luac,venv}
.PHONY: venv
venv:
ifeq (, $(shell which pyenv-virtualenv))
python3 -m venv "$(XDG_CACHE_HOME)/nvim/venv" || true
else
pyenv virtualenv neovim || true
ln -fs "$(shell pyenv prefix neovim)" "$(XDG_CACHE_HOME)/nvim/venv"
endif
"$(XDG_CACHE_HOME)/nvim/venv/bin/pip" install -U pip
"$(XDG_CACHE_HOME)/nvim/venv/bin/pip" install -U pynvim
.PHONY: test
test:
$(info Testing for NVIM >= 0.10.x)
$(if $(shell nvim --version | egrep 'NVIM v0\.1[0-9]\.'),\
$(info OK),\
$(error .. You need Neovim 0.10.x or newer))
@echo All tests passed, hooray!
.PHONY: docker
docker:
docker run -w /root -it --rm alpine:edge sh -uelic ' \
apk add git neovim ripgrep alpine-sdk --update && \
git clone https://github.com/rafi/vim-config ~/.config/nvim && \
cd ~/.config/nvim && nvim'