lucc / nvimpager

Use nvim as a pager to view manpages, diffs, etc with nvim's syntax highlighting
Other
372 stars 20 forks source link

Errors when installing on macOS #3

Closed naughie closed 6 years ago

naughie commented 6 years ago

I use mac OS Sierra 10.12.6, and tried to install nvimpager.

First, I clone git clone https://github.com/lucc/nvimpager.git and make PREFIX=$HOME/.local install as described in README.

Then, first error occurred:

$ make PREFIX=$HOME/.local install
...
sed -i '/hl=/d' autoload/AnsiEsc.vim
sed: 1: "autoload/AnsiEsc.vim": command a expects \ followed by text
make: *** [autoload/AnsiEsc.vim] Error 1

So, I changed sed -i '/hl=/d' autoload/AnsiEsc.vim in makefile to sed -i -e '/hl=/d' autoload/AnsiEsc.vim, and retried installation and got the next errors:

$ nvim makefile
$ make PREFIX=$HOME/.local install
...
echo "---" > metadata.yaml
echo "footer: Version 0.4-4-ge83e103" >> metadata.yaml
echo "date: $(date --date @$(git log -1 --format=format:%at) +%F)" >> metadata.yaml
date: illegal option -- -
usage: date [-jnRu] [-d dst] [-r seconds] [-t west] [-v[+|-]val[ymwdHMS]] ...
            [-f fmt date | [[[mm]dd]HH]MM[[cc]yy][.ss]] [+format]
echo "..." >> metadata.yaml
pandoc --standalone --to man --output nvimpager.1 nvimpager.md metadata.yaml
install -D nvimpager.configured /Users/nakatam/.local/bin/nvimpager
install: illegal option -- D
usage: install [-bCcpSsv] [-B suffix] [-f flags] [-g group] [-m mode]
               [-o owner] file1 file2
       install [-bCcpSsv] [-B suffix] [-f flags] [-g group] [-m mode]
               [-o owner] file1 ... fileN directory
       install -d [-v] [-g group] [-m mode] [-o owner] directory ...
make: *** [install] Error 64

It is because the allowable options of install on mac are different. I modified the makefile from

install: nvimpager.configured $(AUTOLOAD_FILES) $(PLUGIN_FILES) nvimpager.1
    install -D nvimpager.configured $(DESTDIR)$(PREFIX)/bin/nvimpager
    install -D --target-directory=$(DESTDIR)$(RUNTIME)/autoload $(AUTOLOAD_FILES)
    install -D --target-directory=$(DESTDIR)$(RUNTIME)/plugin $(PLUGIN_FILES)
    install -D --target-directory=$(DESTDIR)$(PREFIX)/share/man/man1 nvimpager.1

to

install: nvimpager.configured $(AUTOLOAD_FILES) $(PLUGIN_FILES) nvimpager.1
    mkdir -p $(DESTDIR)$(PREFIX)/bin $(DESTDIR)$(RUNTIME)/autoload $(DESTDIR)$(RUNTIME)/plugin $(DESTDIR)$(PREFIX)/share/man/man1
    install nvimpager.configured $(DESTDIR)$(PREFIX)/bin/nvimpager
    install $(AUTOLOAD_FILES) $(DESTDIR)$(RUNTIME)/autoload
    install $(PLUGIN_FILES) $(DESTDIR)$(RUNTIME)/plugin
    install nvimpager.1 $(DESTDIR)$(PREFIX)/share/man/man1

And the installation finished.

Furthermore, date command seems also to take different parameter, so

echo "date: $$(date --date @$$(git log -1 --format=format:%at) +%F)" >> $@

must be

echo "date: $$(date -r $$(git log -1 --format=format:%at) +%F)" >> $@
lucc commented 6 years ago

Can you try this branch and report back? (Maybe you need to do a make cleanall first.)

By the way: It must not be date -r as that will not work on GNU/Linux :)

Also: Where are the man pages for macOS online? I use to find them with a search engine but the page seems to be broken. That is annoying. Now I just looked up the ones from freebsd but I don't know if they differ from macOS.

lucc commented 6 years ago

Better even, try current develop.

naughie commented 6 years ago

OK, I have been installed nvimpager successfully.

I am sorry I also do not know the man pages online -- I think there is no man page online.

nevd commented 6 years ago

Any chance you can cut a release with this fix in it, I am trying to create a homebrew formula and I am unable to use a branch. Releases and HEAD are acceptable!

lucc commented 6 years ago

The fix is already merged into develop. That is the default branch on github so it is what HEAD points to. Or am I misinterpreting something here?

nevd commented 6 years ago

A git clone does indeed normally point into develop, however when using homebrew and its HEAD feature it repoints to master. I have tried to switch inside the runbook but its proving to be annoyingly difficult.

I was just about to install into a different area till the next release when I got the beep of a new email!

lucc commented 6 years ago

@nevd I decided to release v0.5 now so you can also use that.

nevd commented 6 years ago

Thank you, I will create the formula now. ( it will be a tap at https://github.com/nevd/homebrew-formulae )

nevd commented 6 years ago

@lucc I have dropped in a pull request for a few updates but I will still need to do something a little more to make it work on OSX.

Two of the changes are for nvim to stop it trying to break out of the jail Homebrew wants to create; do not use a swap file and use a local shada file.

The other issue is the use of git log when using a release.

My final issue is the use of sed with inplace editing. The behaviour between bsd/gnu is subtly different, by default. I have used homebrew to pull down gnu-sed and I will patch the makefile to used gsed.

lucc commented 6 years ago

@nevd I do not understand the issue you have with sed. I don't have any bsd sed installed as I am on linux but I tried it with busybox-sed and the command from the makefile works. Also the travis job for OSX works. If there really is some problem with that sed command please report it in a new issue.

nevd commented 6 years ago

@lucc, all problems resolved, no need for another issue to be opened.

I will watch the project and wait for a new release.

I have forked, released and tested both the release install and HEAD.

nevd commented 6 years ago

I was wrong, I was mistaken in thinking it was resolved. Would you consider switching away from using the inplace edit for sed as it is not portable. I can resolve by making gnu-sed a dependency for the recipe but I then have to patch the Makefile to use gsed.

==> Reinstalling nevd/formulae/nvimpager 
==> Downloading https://github.com/lucc/nvimpager/archive/v0.5.1.tar.gz
Already downloaded: /Users/nev/Library/Caches/Homebrew/nvimpager--0.5.1.tar.gz
==> make PREFIX=/usr/local/Cellar/nvimpager/0.5.1 install
Last 15 lines from /Users/nev/Library/Logs/Homebrew/nvimpager/01.make:
wrote ./plugin/cecutil.vim

ewrote ./dxoc/AnsiEsc.txttracted <doc/AnsiEsc.txt>: 205 lines
wrote ./doc/AnsiEsc.txt
did helptags
did helptags
wrote ./doc/AnsiEsc.txt# Remove setting of 'hl', not supported in NeoVim.
sed -i -e '/hl=/d' autoload/AnsiEsc.vim

did helptags# Remove setting of 'hl', not supported in NeoVim.
# Remove setting of 'hl', not supported in NeoVim.
sed -i -e '/hl=/d' autoload/AnsiEsc.vim
sed -i -e '/hl=/d' autoload/AnsiEsc.vim
sed: rename(): No such file or directory
make: *** [plugin/cecutil.vim] Error 1

If reporting this issue please do so at (not Homebrew/brew or Homebrew/core): https://github.com/nevd/homebrew-formulae/issues

lucc commented 6 years ago

It works on travis: https://travis-ci.org/lucc/nvimpager/jobs/412177052#L472

So what is the difference between your system and the one on travis and where can I find the docs for your version of sed?

lucc commented 6 years ago

I found out that it should not be needed any longer, 871adb1 is now in develop.

nevd commented 6 years ago

Thank you, will wait for the next release to test!

lucc commented 6 years ago

I switched from vimscript to lua in the development branch and will still test this for some more time before making a release. So If you do not want to try develop I am afraid you might have to wait a little while.