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-14 07:26:21 +00:00
|
|
|
INSTALLED := $(shell command -v vim 1>&2 >/dev/null ; echo $$? )
|
|
|
|
|
|
|
|
install: | init update
|
|
|
|
|
|
|
|
init:
|
|
|
|
ifneq ($(INSTALLED), 0)
|
|
|
|
$(error Vim not installed)
|
|
|
|
endif
|
|
|
|
$(info => Setting up vim)
|
2019-04-14 23:04:51 +00:00
|
|
|
@ [ -e ~/.vim ] && echo " ~/.vim already exist. Skipping." || ln -svf $(SRC_DIR) $(TARGET_DIR)
|
|
|
|
@ [ -e ~/.vimrc ] && echo " ~/.vimrc already exist. Skipping." || ln -svf $(TARGET_DIR)/vimrc ~/.vimrc
|
2019-04-14 07:26:21 +00:00
|
|
|
|
|
|
|
update:
|
|
|
|
$(info => Updating vim)
|
|
|
|
@ curl -fsLo $(SRC_DIR)/autoload/plug.vim https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
|
|
|
@ [ $(INSTALLED) -ne 0 ] || vim +PlugInstall +PlugUpdate +qall
|
|
|
|
|
|
|
|
remove:
|
|
|
|
@ [ -L ~/.vimrc ] && rm -f ~/.vimrc || echo "~/.vimrc is not a symbolic link. Skipping"
|
|
|
|
@ [ -L ~/.vim ] && rm -f ~/.vim || echo "~/.vim is not a symbolic link. Skipping"
|
|
|
|
|
|
|
|
|
|
|
|
.PHONY: install update init
|