lucc / nvimpager

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

Add show lines number feature #26

Closed kevinhwang91 closed 4 years ago

kevinhwang91 commented 4 years ago

Add show lines number like cat.

I'm a newbie of lua, maybe the code is not good enough.

kevinhwang91 commented 4 years ago

Thank you for proposing that! I added some comments, can you please fix that, I will do more reviewing after that.

One question came up when I thought about that: nvimpager -cn file works as expected, but what would you expect for nvimpager -pn file? Should that :set nu in the pager? Or should we rather have -n imply -c so that nvimpager -n file is equivalent to nvimpager -cn file. And if people want to :set nu in the pager they have to put it in the rc file or use nvimpager file -c 'se nu'?

You are well-considered. I have added the code about show line in pager mode. MANPAGER='nvimpager -pn' man man will show the line number in nvim.

I have cleaned the messed indent code and deleted the log file, please review again.

kevinhwang91 commented 4 years ago

I found a line wrapped issue for man. Have solved it by specifying MANWIDTH manually.

Updated: It's hard to handle this issue if the date from the stream or a file isn't located the man's path.