lucc / nvimpager

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

Pager is very slow on git log -p #18

Closed 3v1n0 closed 4 years ago

3v1n0 commented 4 years ago

I'm using nvimpager as my default pager and while being slightly slow for some things (understandable though)

This is probably not just an issue with this script though as I'm noticing the same on pure vim and neovim.

It's just enough to launch git log -p and neovim starts hanging and after some time it will open the file

However this script instead of streaming the actual file contents, it creates a local file that can be quite big, and it's something I assume that a pager should not do, by instead just streaming the content

This is the temp file it's trying to open

ls -lht /tmp/tmp.HvMx4niUZz 
-rw------- 1 marco marco 541M ott 24 23:47 /tmp/tmp.HvMx4niUZz
lucc commented 4 years ago

This is a known issue. It is noted in the README under known issues and as the last item of the todo list.

nvimpager saves stdin to a file in order to decide if it is small enough to use cat mode or if pager mode is needed. Currently I only know how to do this with wc on a temp file. I tried to experiment with a pure vimscript solution so that I could stream stdin directly into nvim but did not come up with a solution until now. Maybe you have an idea how that can be done?

lucc commented 4 years ago

I think I was waiting for https://github.com/neovim/neovim/issues/7438 in order to come back to this.

lucc commented 4 years ago

As a workaround you can use export PAGER='nvimapger -p' which disables auto mode and does not use the temp file. You will still have the "hanging" neovim until all of the input did arrive (see known issues).