2019-04-14 07:26:21 +00:00
|
|
|
SRC_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
|
2019-04-14 23:04:51 +00:00
|
|
|
TARGET_DIR := ~/.vim
|
2019-04-27 22:21:00 +00:00
|
|
|
PLUG_URL := https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
|
|
|
PLUG_PATH := $(SRC_DIR)/autoload/plug.vim
|
|
|
|
|
|
|
|
include ../lib/shared.mk
|
2019-04-14 07:26:21 +00:00
|
|
|
|
|
|
|
install: | init update
|
|
|
|
|
|
|
|
init:
|
2020-03-09 17:30:45 +00:00
|
|
|
if (( $$+commands[vim] )) ; then
|
|
|
|
$(report) header "Setting up vim"
|
2021-07-20 18:47:54 +00:00
|
|
|
mkdir -p $(TARGET_DIR)
|
2020-03-09 17:30:45 +00:00
|
|
|
$(mk_link) $(SRC_DIR)/vimrc ~/.vimrc
|
2021-07-20 18:47:54 +00:00
|
|
|
$(mk_link) $(SRC_DIR)/vimrc.d $(TARGET_DIR)/vimrc.d
|
|
|
|
$(mk_link) $(SRC_DIR)/spell $(TARGET_DIR)/spell
|
|
|
|
( mkdir -p $(TARGET_DIR)/backup \
|
|
|
|
&& chmod 700 $(TARGET_DIR)/backup ) \
|
|
|
|
; $(report) "setting up backup dir"
|
2020-03-09 17:30:45 +00:00
|
|
|
else
|
|
|
|
$(report) warn "cannot find vim?"
|
|
|
|
fi
|
2019-04-14 07:26:21 +00:00
|
|
|
|
|
|
|
update:
|
2020-03-09 17:30:45 +00:00
|
|
|
if (( $$+commands[vim] )) ; then
|
|
|
|
$(report) header "Upgrading vim"
|
|
|
|
curl -fsLo $(PLUG_PATH) $(PLUG_URL) \
|
|
|
|
; $(report) "vim plug setup"
|
2021-07-20 18:47:54 +00:00
|
|
|
vim +PlugInstall +PlugUpdate +PlugClean +qall \
|
2020-03-09 17:30:45 +00:00
|
|
|
; $(report) "downloading/updating plugins"
|
2020-05-28 17:29:19 +00:00
|
|
|
stty sane # dropping in & out causes some weird tty behavior.
|
2020-03-09 17:30:45 +00:00
|
|
|
else
|
|
|
|
$(report) warn "cannot find vim?"
|
|
|
|
fi
|
|
|
|
|
2019-04-14 07:26:21 +00:00
|
|
|
|
|
|
|
remove:
|
2020-03-09 17:30:45 +00:00
|
|
|
$(report) header "Removing vim config"
|
2019-12-13 17:00:11 +00:00
|
|
|
$(rm_link) ~/.vimrc
|
|
|
|
$(rm_link) $(TARGET_DIR)
|