bat-extras icon indicating copy to clipboard operation
bat-extras copied to clipboard

batgrep|batpipe keyword search/highlight looks bad

Open ciscohack opened this issue 3 years ago • 6 comments

Hi Team,

I am using batgrep for keyward search in file and output rendering i feel is not prettier and i feel can be better. Please help me if we can address this with some config tweak. batpipe also instead of using less as pager working like cat application and processing all content in one go making screen unresponsive due to rendering or huge file.

image Please help me to know how we can correct this rendering.

-Praveen

ciscohack avatar Apr 10 '21 14:04 ciscohack

@eth-p My friend i need your help on this and batpipe also not working this command on my shell not resulting any output eval "$(batpipe)" and whenever i run batpipe <file.txt> instead of less batpipe behave like cat application and Above screenshot you can see batgrep doing selection for first line as well as next empty space which looks bad. please help

ciscohack avatar Apr 10 '21 15:04 ciscohack

I am using batgrep for keyward search in file and output rendering i feel is not prettier and i feel can be better.

This should be fixed as of 4f0b961d12d8801a0663be59d6eae07a8f73faa7. The script was using bat as the pager instead of less when PAGER=bat is set, which was causing the bad rendering.

batpipe also instead of using less as pager working like cat application and processing all content in one go making screen unresponsive due to rendering or huge file.

batpipe isn't meant to be run directly. It follows the LESSOPEN specification, and should only be indirectly executed by less itself.

To use it, add this to your .zshrc:

export LESSOPEN="|batpipe %s"
export BATPIPE="color"
LESS="$LESS -R"
unset LESSCLOSE

Then, any time you run less [file], it should be pretty printed by bat.

eth-p avatar Apr 10 '21 19:04 eth-p

@eth-p Thanks a lot my friend for quick response so batpipe is just do like this less file.txt | batpipe right. So i should not run it directly right. Thanks i will setup the config as your suggested and test.

Yes Bat has some rendering issues. but you and sharp working to make to robust and better hope we will have better answer in future updates

ciscohack avatar Apr 10 '21 21:04 ciscohack

sorry i wrote wrong after setting environment variable in zshrc file. i just have to run less file.txt. batpipe will do the magic automatically right?

ciscohack avatar Apr 10 '21 21:04 ciscohack

sorry i wrote wrong after setting environment variable in zshrc file. i just have to run less file.txt. batpipe will do the magic automatically right?

Yep!

eth-p avatar Apr 10 '21 22:04 eth-p

Thanks bro you are amazing

ciscohack avatar Apr 10 '21 22:04 ciscohack