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))))
|
SRC_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
|
||||||
TARGET_DIR := ~/.vim
|
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
|
install: | init update
|
||||||
|
|
||||||
init:
|
init:
|
||||||
ifneq ($(INSTALLED), 0)
|
ifneq ($(call cmd_exist,vim), true)
|
||||||
$(error Vim not installed)
|
$(error Vim not installed)
|
||||||
endif
|
endif
|
||||||
$(info => Setting up vim)
|
$(info => Setting up vim)
|
||||||
@ [ -e ~/.vim ] && echo " ~/.vim already exist. Skipping." || ln -svf $(SRC_DIR) $(TARGET_DIR)
|
@ $(mk_link) $(SRC_DIR) $(TARGET_DIR)
|
||||||
@ [ -e ~/.vimrc ] && echo " ~/.vimrc already exist. Skipping." || ln -svf $(TARGET_DIR)/vimrc ~/.vimrc
|
@ $(mk_link) $(SRC_DIR)/vimrc ~/.vimrc
|
||||||
|
|
||||||
update:
|
update:
|
||||||
|
ifneq ($(call cmd_exist,vim), true)
|
||||||
|
$(error Vim not installed)
|
||||||
|
endif
|
||||||
$(info => Updating vim)
|
$(info => Updating vim)
|
||||||
@ curl -fsLo $(SRC_DIR)/autoload/plug.vim https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
curl -fsLo $(PLUG_PATH) $(PLUG_URL) ; $(report) "vim plug setup"
|
||||||
@ [ $(INSTALLED) -ne 0 ] || vim +PlugInstall +PlugUpdate +qall
|
vim +PlugInstall +PlugUpdate +qall ; $(report) "downloading/updating plugins"
|
||||||
|
|
||||||
remove:
|
remove:
|
||||||
@ [ -L ~/.vimrc ] && rm -f ~/.vimrc || echo "~/.vimrc is not a symbolic link. Skipping"
|
$(info => Removing vim config)
|
||||||
@ [ -L ~/.vim ] && rm -f ~/.vim || echo "~/.vim is not a symbolic link. Skipping"
|
@ $(rm_link) ~/.vimrc
|
||||||
|
@ $(rm_link) $(TARGET_DIR)
|
||||||
|
|
||||||
.PHONY: install update init
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user