nvimpager icon indicating copy to clipboard operation
nvimpager copied to clipboard

Config option for pager mode always

Open mike-lloyd03 opened this issue 3 years ago • 2 comments

It would be great if there were a configuration option for forcing pager mode rather than having to use the -p flag. Setting the PAGER variable with a flag isn't possible and you also can set an environment variable to a custom function. The workaround I have in place is a script like this:

#!/bin/bash

nvimpager -p <&0

And setting PAGER to that script which is not desirable.

Something like:

lua nvimpager.force_pager_mode = true

and maybe an equivalent command for cat mode would be great.

Thanks for nvimpager!

mike-lloyd03 avatar Nov 23 '22 06:11 mike-lloyd03

This is not possible with the current design of nvimpager:

In pager mode nvim is started normally with a TUI, in cat mode nvim is started with the --headless flag. But when you set an option in lua or vimscript (wither by --cmd, -c or -u) it will only be available after the nvim process has started. We can not change the headless mode after starting nvim.

I hope to change the architecture after https://github.com/neovim/neovim/issues/7438 is fixed (the first step is https://github.com/neovim/neovim/pull/18375). It might be possible then.

lucc avatar Nov 23 '22 07:11 lucc

I'm actually putting together a janky PR right now. Let me know what you think once it's up.

mike-lloyd03 avatar Nov 23 '22 07:11 mike-lloyd03