Skip to content
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

Merged
merged 9 commits into from
Jun 20, 2016

Conversation

lucc
Copy link
Collaborator

@lucc lucc commented May 10, 2016

Related to #182.

@rkitover
Copy link
Owner

I like it, this will help with #182 immensely.

Some notes:

  1. yes we still need to recombine into standalone/vimcat in the Makefile, you'll need to modify scripts/balance-shellvim and update the install section in the Makefile etc.
  2. use set rtp^= not set rtp+= so the path is first in the list
  3. if you are reindenting, might as well use the same indent settings as vimpager, and add a modeline
  4. and speaking of which, if you want to change the indent style in both vimpager and vimcat to something more standard like 4 spaces I'm fine with that, I chose hard tabs a very long time ago because that's what I read linux uses but I know better now.

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.

@lucc
Copy link
Collaborator Author

lucc commented May 12, 2016

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 standalone/vimpager to bundle vimcat+autoload/vimcat.vim or rather standalone/vimcat? I vote for the first.

@rkitover
Copy link
Owner

@lucc yes it would make sense to bundle the split vimcat instead of the recombined vimcat of course.

@rkitover
Copy link
Owner

@lucc so I can just merge this and do the makefile stuff myself, is that ok with you?

@lucc
Copy link
Collaborator Author

lucc commented May 12, 2016

If you are eager to do it you can, I was just about to try it myself. Your choice.

@rkitover
Copy link
Owner

@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.

@lucc
Copy link
Collaborator Author

lucc commented May 12, 2016

ok

@lucc lucc force-pushed the split-vimcat branch 2 times, most recently from 6ff02a0 to 713e8e4 Compare May 12, 2016 10:47
@lucc
Copy link
Collaborator Author

lucc commented May 12, 2016

I think I fixed standalone/vimpager. Please try it. standalone/vimcat is still missing.

@lucc lucc force-pushed the split-vimcat branch 2 times, most recently from bc1df23 to edf92fb Compare May 14, 2016 11:12
@rkitover
Copy link
Owner

@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.

@lucc
Copy link
Collaborator Author

lucc commented May 18, 2016

I fix this branch again. At the moment there are a lot of small commits, I think it is easier to review it this way. I will prepare a cleaned up history and when the review is done I can push that so it can be merged.

I pushed the clean history.

@lucc lucc force-pushed the split-vimcat branch 3 times, most recently from 307b4da to 37c7595 Compare May 19, 2016 06:09
@lucc lucc force-pushed the split-vimcat branch 2 times, most recently from 86129a4 to 9a345ee Compare June 19, 2016 08:04
@lucc lucc mentioned this pull request Jun 19, 2016
@rkitover
Copy link
Owner

@lucc sorry I didn't see that you updated it, looking now.

@lucc lucc mentioned this pull request Jun 20, 2016
lucc added 4 commits June 20, 2016 11:59
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.
@lucc
Copy link
Collaborator Author

lucc commented Jun 20, 2016

Rebased.
@rkitover I will leave it up you how to change debian/copyright in order to fix the lintian failure on travis. I don't know if the new vimcat and autoload/vimcat.vim should be copyright by you or the original author.

@rkitover rkitover merged commit 93047d5 into rkitover:master Jun 20, 2016
rkitover added a commit that referenced this pull request Jun 20, 2016
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 lucc deleted the split-vimcat branch June 20, 2016 21:56
@rkitover
Copy link
Owner

@lucc the sed is not compatible with BSD sed (which is closer to osed), and osed (e.g. solaris /bin/sed) commands like a and i have to be in the form:

a\
text

Also, not directly related, but we seem to have lost compatibility with some versions of make, like BSD make.

I'm investigating both of these issues.

@lucc
Copy link
Collaborator Author

lucc commented Jun 21, 2016

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/' >> $@

@rkitover
Copy link
Owner

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants