-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Split vimcat into a normal shell script and a separate vim script. #183
Conversation
I like it, this will help with #182 immensely. Some notes:
If you'd like me to help, push the branch to this repo. And by the way, you can make branches in this repo and open PRs just the same for discussion. I'm going to start opening PRs too for major work so I can discuss them. |
Will push to brnches on this repo in the future (I think I would have to open a new PR because I can not change the origin of this PR so I'm to lazy this time) I suggest to do point 4 in the next PR. 2+3 are done. About point 1: would you prefer |
@lucc yes it would make sense to bundle the split vimcat instead of the recombined vimcat of course. |
@lucc so I can just merge this and do the makefile stuff myself, is that ok with you? |
If you are eager to do it you can, I was just about to try it myself. Your choice. |
@lucc if you are about to do it that's fine with me, I'll wait. I need to work on the streaming stuff anyway. |
ok |
6ff02a0
to
713e8e4
Compare
I think I fixed standalone/vimpager. Please try it. standalone/vimcat is still missing. |
bc1df23
to
edf92fb
Compare
@lucc looks good, standalone/vimpager works for me. Sorry for creating more work for you, but after previous discussion I changed the indentation to 4 spaces in master and I changed the code a bit too. Also I'm probably going to do some more work on vimcat in the next few days, so when you're ready to merge just re-create the files from master, commit the minor changes you made to master if that would make it easier. |
I fix this branch again. I pushed the clean history. |
307b4da
to
37c7595
Compare
86129a4
to
9a345ee
Compare
@lucc sorry I didn't see that you updated it, looking now. |
Most vim code is moved to autoload/vimcat.vim. A new configuration variable is added at the top of the script to hand the extra runtimepath component to find this file to vim. Like this the vimcat script does not need to source itself any more. The balancing statements are removed. The shell code is reindented to match the new modeline. The main `set - ...` command before calling vim is reformatted to make it more readable and to make it easier to modify it from the makefile. Some superfluous comments and quotes are removed.
The function vimcat#Run gets an extra argument to make this possible. The handling of $VIMCAT_DEBUG is also moved to autoload/vimcat.vim.
Rebased. |
Assign myself (Rafael Kitover) as the copyright holder for the shell script portion, since the original utility was just the viml, and assign original author of AnsiHighlight for the viml portion.
@lucc the sed is not compatible with BSD sed (which is closer to osed), and osed (e.g. solaris /bin/sed) commands like
Also, not directly related, but we seem to have lost compatibility with some versions of I'm investigating both of these issues. |
Are you talking about the sed command in the makefile to build standalone/vimcat? Does this work: diff --git a/Makefile b/Makefile
index fe749a6..c1321a7 100644
--- a/Makefile
+++ b/Makefile
@@ -66,7 +66,8 @@ standalone/vimpager: vimpager vimpager-version.txt ${SRC:=.uu} inc/* Makefile
standalone/vimcat: vimcat autoload/vimcat.vim inc/prologue.sh Makefile
@echo building $@
@${MKPATH} ${@D}
- @sed -e '1 a : if 0' \
+ sed -e '1 a\' \
+ -e ': if 0' \
-e 's/^\( *\)# INSERT VIMCAT_DEBUG PREPARATION HERE$$/\1if [ "$${VIMCAT_DEBUG:-0}" -eq 0 ]; then silent="silent! "; else silent=; fi/' \
-e 's|^version=.*|version="'"`cat vimcat-version.txt`"' (standalone, shell=\$$(command -v \$$POSIX_SHELL))"|' \
-e '/^runtime=.*/d' \ Otherwise we can also do this with separated commands: diff --git a/Makefile b/Makefile
index fe749a6..917ce64 100644
--- a/Makefile
+++ b/Makefile
@@ -66,7 +66,9 @@ standalone/vimpager: vimpager vimpager-version.txt ${SRC:=.uu} inc/* Makefile
standalone/vimcat: vimcat autoload/vimcat.vim inc/prologue.sh Makefile
@echo building $@
@${MKPATH} ${@D}
- @sed -e '1 a : if 0' \
+ @head -n 1 vimcat > $@
+ @echo : if 0 >> $@
+ @sed -e '1d' \
-e 's/^\( *\)# INSERT VIMCAT_DEBUG PREPARATION HERE$$/\1if [ "$${VIMCAT_DEBUG:-0}" -eq 0 ]; then silent="silent! "; else silent=; fi/' \
-e 's|^version=.*|version="'"`cat vimcat-version.txt`"' (standalone, shell=\$$(command -v \$$POSIX_SHELL))"|' \
-e '/^runtime=.*/d' \
@@ -77,7 +79,7 @@ standalone/vimcat: vimcat autoload/vimcat.vim inc/prologue.sh Makefile
-e 'r inc/prologue.sh' \
-e d \
-e '}' \
- vimcat > $@
+ vimcat >> $@
@awk '/^[ ]*(if|for|while)/ { print $$1 }' vimcat \
| sed '1!G;h;$$!d' \
| sed -e 's/^/: end/' >> $@ |
@lucc I fixed the remaining vimcat issues, and I fixed the Makefile for Solaris make (which seems to be some variant of dmake) but it still does not work on FreeBSD or OpenBSD make, I'll see if this is fixable and if not I will amend the docs to tell *BSD users to use gmake. |
Related to #182.