Updated vim to current makefile format.
This commit is contained in:
parent
159e2d6b1b
commit
7bd836b67c
26
vim/makefile
26
vim/makefile
|
@ -1,25 +1,29 @@
|
|||
SRC_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
|
||||
TARGET_DIR := ~/.vim
|
||||
INSTALLED := $(shell command -v vim 1>&2 >/dev/null ; echo $$? )
|
||||
PLUG_URL := https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
||||
PLUG_PATH := $(SRC_DIR)/autoload/plug.vim
|
||||
|
||||
include ../lib/shared.mk
|
||||
|
||||
install: | init update
|
||||
|
||||
init:
|
||||
ifneq ($(INSTALLED), 0)
|
||||
ifneq ($(call cmd_exist,vim), true)
|
||||
$(error Vim not installed)
|
||||
endif
|
||||
$(info => Setting up vim)
|
||||
@ [ -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
|
||||
@ $(mk_link) $(SRC_DIR) $(TARGET_DIR)
|
||||
@ $(mk_link) $(SRC_DIR)/vimrc ~/.vimrc
|
||||
|
||||
update:
|
||||
ifneq ($(call cmd_exist,vim), true)
|
||||
$(error Vim not installed)
|
||||
endif
|
||||
$(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
|
||||
curl -fsLo $(PLUG_PATH) $(PLUG_URL) ; $(report) "vim plug setup"
|
||||
vim +PlugInstall +PlugUpdate +qall ; $(report) "downloading/updating plugins"
|
||||
|
||||
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
|
||||
$(info => Removing vim config)
|
||||
@ $(rm_link) ~/.vimrc
|
||||
@ $(rm_link) $(TARGET_DIR)
|
||||
|
|
Loading…
Reference in New Issue
Block a user