Permalink
Browse files

[vim] delimitMate update

  • Loading branch information...
guns committed Sep 13, 2013
1 parent af04f23 commit 233aca0a3e22245299a7e85a3265e2cc57cc5a16
@@ -1,62 +1,82 @@
-PLUGIN=$(shell basename "$$PWD")
-SCRIPT=$(wildcard plugin/*.vim)
-#AUTOL=$(wildcard autoload/*.vim)
-AUTOL=autoload/$(PLUGIN).vim
-DOC=$(wildcard doc/*.txt)
-TESTS=$(wildcard autoload/*Tests.vim)
-VERSION=$(shell perl -ne 'if (/\*\sCurrent\srelease:/) {s/^\s+(\d+\.\S+)\s.*$$/\1/;print}' $(DOC))
-VIMFOLDER=~/.vim/
-VIM=/usr/bin/vim
+PLUGIN = $(wildcard plugin/*.vim)
+SOURCES = $(PLUGIN)
+LIB = $(wildcard autoload/*.vim)
+SOURCES += $(LIB)
+DOC = $(wildcard doc/*.txt)
+SOURCES += $(DOC)
+#NAME = $(shell basename "$$PWD")
+NAME = delimitMate
+VERSION = $(shell $(SED) -n -e '/Current \+release/{s/^ \+\([0-9.]\+\).*/\1/;p;}' $(firstword $(DOC)))
+FILENAME = $(NAME)-$(VERSION)
+DESTDIR = $(HOME)/.vim
+VIM = vim
+SED = gsed
+PERL = perl
+comma := ,
+empty :=
+space := $(empty) $(empty)
-.PHONY: $(PLUGIN).vba README
+.PHONY: version clean distclean undo release test install uninstall
-all: vimball README zip gzip
-
-vimball: $(PLUGIN).vba
+all: zip gzip
+dist: version all
+vimball: $(FILENAME).vmb
+zip: $(FILENAME).zip $(FILENAME).vmb.zip
+gzip: $(FILENAME).tar.gz $(FILENAME).vmb.gz
clean:
- @echo clean
- rm -f *.vba */*.orig *.~* .VimballRecord *.zip *.gz
+ rm -f */*.orig *.~* .VimballRecord *.zip *.gz *.vmb
-dist-clean: clean
+distclean: clean
+ -zsh -c 'setopt extendedglob; rm -f ^(README.md|Makefile)'
+ -zsh -c 'setopt extendedglob; rm -f .^(git|README.md|Makefile)*'
undo:
for i in */*.orig; do mv -f "$$i" "$${i%.*}"; done
-README:
- @echo README
- cp -f $(DOC) README
-
-$(PLUGIN).vba:
- @echo $(PLUGIN).vba
- rm -f $(PLUGIN)-$(VERSION).vba
- $(VIM) -N -c 'ru! vimballPlugin.vim' -c ':call append("0", [ "$(SCRIPT)", "$(AUTOL)", "$(DOC)"])' -c '$$d' -c ":%MkVimball $(PLUGIN)-$(VERSION) ." -c':q!'
- ln -f $(PLUGIN)-$(VERSION).vba $(PLUGIN).vba
-
-zip:
- @echo zip
- rm -f *.zip
- zip -r $(PLUGIN).zip doc plugin autoload
- zip $(PLUGIN).zip -d \*.sw\? || echo 1
- zip $(PLUGIN).zip -d \*.un\? || echo 1
- zip $(PLUGIN).zip -d \*.orig || echo 1
- zip $(PLUGIN).zip -d \*tags || echo 1
- zip $(PLUGIN).zip -d $(TESTS)
- ln -f $(PLUGIN).zip $(PLUGIN)-$(VERSION).zip
-
-gzip: vimball
- @echo vimball
- gzip -f $(PLUGIN).vba
-
-release: version all
-
version:
- @echo version: $(VERSION)
- perl -i.orig -pne 'if (/^"\sVersion:/) {s/(\d+\.\S+)/$(VERSION)/}' $(SCRIPT) $(AUTOL)
- perl -i.orig -pne 'if (/let\sdelimitMate_version/) {s/"(\d+\.\S+)"/"$(VERSION)"/}' $(SCRIPT)
- perl -i.orig -pne 'if (/beasts/) {s/(v\d+\.\S+)/v$(VERSION)/}' $(DOC)
- perl -i.orig -MPOSIX -pne 'if (/^"\sModified:/) {$$now_string = strftime "%F", localtime; s/(\d+-\d+-\d+)/$$now_string/e}' $(SCRIPT) $(AUTOL)
- perl -i.orig -MPOSIX -pne 'if (/^\s+$(VERSION)\s+\d+-\d+-\d+\s+\*/) {$$now_string = strftime "%F", localtime; s/(\d+-\d+-\d+)/$$now_string/}' $(DOC)
- @echo Version: $(VERSION)
-
-echo:
+ $(PERL) -i.orig -pne 'if (/^"\sVersion:/) {s/(\d+\.\S+)/$(VERSION)/}' $(PLUGIN) $(LIB)
+ $(PERL) -i.orig -pne \
+ 'if (/let\sdelimitMate_version/) {s/"(\d+\.\S+)"/"$(VERSION)"/}' $(PLUGIN)
+ $(PERL) -i.orig -pne 'if (/beasts/) {s/(v\d+\.\S+)/v$(VERSION)/}' $(DOC)
+ $(PERL) -i.orig -MPOSIX -pne \
+ 'if (/^"\sModified:/) {$$now_string = strftime "%F", localtime; s/(\d+-\d+-\d+)/$$now_string/e}' \
+ $(PLUGIN) $(LIB)
+ $(PERL) -i.orig -MPOSIX -pne \
+ 'if (/^\s+$(VERSION)\s+\d+-\d+-\d+\s+\*/) {$$now_string = strftime "%F", localtime; s/(\d+-\d+-\d+)/$$now_string/}' \
+ $(DOC)
+
+test:
+ runVimTests -0 test
+
+install: $(SOURCES)
+ for dir in $(^D);\
+ do install -d -m 0755 $(DESTDIR)$(PREFIX)/$$dir;\
+done;\
+for file in $^;\
+ do install -m 0644 $$file $(DESTDIR)$(PREFIX)/$$file;\
+done;
+
+uninstall:
+ for file in $(SOURCES);\
+ do rm -f $(DESTDIR)$(PREFIX)/$$file;\
+done;
+
+%.vmb: $(SOURCES)
+ $(VIM) -N -es -u NORC \
+ -c 'call setline(1,["$(subst $(space),"$(comma)",$^)"])'\
+ -c "%MkVimball! $(basename $@) ." -c 'q!'
+
+%.vmb.zip: vimball
+ zip $@ $(basename $@)
+
+%.zip: $(SOURCES)
+ zip $@ $^
+
+%.vmb.gz: vimball
+ gzip -f $(basename $@)
+
+%.tar.gz: $(SOURCES)
+ tar -cvzf $@ $^
+
+# vim:ts=2:sw=2
@@ -1,3 +0,0 @@
-This plug-in provides automatic closing of quotes, parenthesis, brackets, etc., besides some other related features that should make your time in insert mode a little bit easier, like syntax awareness (will not insert the closing delimiter in comments and other configurable regions), <CR> and <Space> expansions (off by default), and some more.
-
-Most of the features can be modified or disabled permanently, using global variables, or on a FileType basis, using :autocmd. With a couple of exceptions and limitations, these features don't break undo, redo or history.
@@ -0,0 +1,6 @@
+This plug-in provides automatic closing of quotes, parenthesis, brackets, etc., besides some other related features that
+should make your time in insert mode a little bit easier, like syntax awareness (will not insert the closing delimiter
+in comments and other configurable regions), <CR> and <Space> expansions (off by default), and some more.
+
+Most of the features can be modified or disabled permanently, using global variables, or on a FileType basis, using
+:autocmd.
Oops, something went wrong.

0 comments on commit 233aca0

Please sign in to comment.