Closed nocibambi closed 3 years ago
This looks like you have an appimage version of neovim installed. What does which -a nvim
tell you? How did you install nvim and nvimpager?
This might be hard to read but you can debug the bash script and see what it does like so:
bash -x nvimpager file
PAGER="bash -x nvimpager" man something
You might find some indication if a different $PATH
(and hence different nvim) is used in your shell and when man runs your $PAGER
.
If you have different nvim versions installed you can also try PAGER=nvimpager NVIM=/the/good/version/of/nvim man man
.
You sudo seems to use a different man path and nvimpager seems to be installed somewhere where this man path is not looking. Compare man -w
and sudo man -w
and also check man -w nvimpager
.
@nocibambi did you find any further info with my hints above? Also please note that sudo will clear the environment by default (see sudo -E
in the man page).
If there is no new input from your side I consider this a configuration issue and will close it at some point :)
@lucc, sorry for the lack of reactions.
I had other issues on my system and I hoped to upgrade to Ubuntu 20.04 and see if that solves it.
But I am still not there yet :roll_eyes:, so here is what I can tell now.
Yes this is an Appimage version. Would it be better if I would have a different one installed?
Here is the result of which
.
$ which -a nvim
/usr/bin/nvim
However, the appimage's location is at ~/.local/share/nvim/nvim.appimage
. I can run both.
nvipager file
. I do not see any discrepancy, but nor do I understand too much of what does this show.$ bash -x nvimpager brightness_illyana_night_mode
+ RUNTIME=/home/andras/.local/share/nvimpager/runtime
+ export RUNTIME
+ export PPID
+ name=nvimpager
+ mode=auto
+ rc=/home/andras/.config/nvimpager/init.vim
+ nvim=nvim
+ getopts achpv flag
+ shift 0
+ [[ 1 -eq 0 ]]
+ [[ ! -t 1 ]]
+ [[ ! -r /home/andras/.config/nvimpager/init.vim ]]
+ rc=NORC
+ files=()
+ [[ 1 -gt 0 ]]
+ [[ -f brightness_illyana_night_mode ]]
+ files+=("$1")
+ shift
+ [[ 0 -gt 0 ]]
+ [[ auto != pager ]]
+ [[ 1 -eq 0 ]]
+ [[ ! -t 0 ]]
+ default_args=(-R ${rc:+-u "$rc"} --cmd 'set rtp+=$RUNTIME' --cmd 'lua nvimpager = require("nvimpager")' --cmd 'lua nvimpager.stage1()' -c 'lua nvimpager.stage2()')
+ [[ auto = cat ]]
+ [[ auto = auto ]]
++ cat brightness_illyana_night_mode
++ wc -l
++ tput lines
+ [[ 16 -le 55 ]]
+ default_args+=(--headless)
+ nvim -R -u NORC --cmd 'set rtp+=$RUNTIME' --cmd 'lua nvimpager = require("nvimpager")' --cmd 'lua nvimpager.stage1()' -c 'lua nvimpager.stage2()' --headless
I set PAGER="bash -x nvimpager"
, but it did not change the results.
I changed NVIM
path to point to the appimage file, but neither this change the results.
I also checked the man paths.
Manpath with sudo indeed does not contain paths under my home folder (e.g. the manpath for nvimpager)
$ man -w nvimpager
/home/andras/.local/share/man/man1/nvimpager.1
I tried to set it based on this SO post, but so far without success.
I am still confused here. You say you have /usr/bin/nvim
and that is an appimage version but the appimage is at ~/.local/share/nvim/nvim.appimage
.
Could you please use which -a nvim
to see all the versions of nvim that are in your path. Then please check with ls -l
if these are symbolic links. Please clarify which if these is an appimage.
Just for completeness you could also check if you have multible versions of nvimpager installed with which -a nvimpager
.
bash -x
should not change the result in the sense that it should work if it works without the -x
and should also not work, if it did not work without the -x
. All it does is print each line of the bash script just before it is executed (with variables expanded). That's the + ...
lines you see. It is called bash's trace mode, you can check man bash
to learn more about that.
NVIM
Please remember that it needs to be an environment variable. So you need to export it or set it for one command. You did not specify what exactly you did here.
For example compare these (the python command is just some command that prints an environment variable):
# this is not exported
VAR=x
python -c 'import os; print(os.environ.get("VAR"))'
# this will only last for the current command
VAR=y python -c 'import os; print(os.environ.get("VAR"))'
# it will not work any longer
python -c 'import os; print(os.environ.get("VAR"))'
# this will work for the shell session
export VAR=z
python -c 'import os; print(os.environ.get("VAR"))'
You can verify that the NVIM variable is picked up by nvimpager with the bash -x
trick from above. So try NVIM=foobar bash -x nvimpager file
and bash should tell you that it sets nvim=foobar
and on the last line it tries to execute foobar -R -u NORC ...
and will (hopefully :) not find the command.
So we could check the output of PAGER='bash -x nvimpager' man man
which should print the trace and inform us which nvim command nvimpager pickes up when run under man. We could compare this with the bash -x nvimpager some-file
which you executed on the command line and posted above. Maybe they use a different version of nvim
.
@nocibambi did you follow up on this?
@lucc First of all, thanks for the help. Sorry for the late response. Finally, I decided to upgrade Ubuntu to 20.04 and probably that solved it.
For reference, here are the details of my environment.
# nvim
andras@barat:~$ which -a nvim
/usr/bin/nvim
andras@barat:~$ ls -l /usr/bin/nvim
-rwxr-xr-x 1 root root 3469640 dec 1 2019 /usr/bin/nvim
# nvimpager
andras@barat:~$ which -a nvimpager
/home/andras/.local/bin/nvimpager
andras@barat:~$ ls -l /home/andras/.local/bin/nvimpager
-rwxr-xr-x 1 andras andras 2703 aug 26 07:46 /home/andras/.local/bin/nvimpager
export VISUAL=nvim
export EDITOR="$VISUAL"
export PAGER=nvimpager
export MANPAGER=nvimpager
man nvimpager
works and brings up the man page in nvim.
My ultimate goal would be to use nvim as the pager in bash, ranger, git, etc.
Currently, nvimpager works as a terminal command (e.g.
nvimpager nvimpager.md
)However, when I set nvimpager as the default pager in bash (
export PAGER=nvimpager
) and try to run it, I get the following error message:I found the following related issues
Based on them this might be an nvim issue, but for me, nvim works just fine.
Interestingly, as it mentions a permission issue, I tried to run the command with
sudo
but it seems that it would not work even withless
.Environment
Any ideas of how I could try to solve this?