Bat: Option to clear content when quit

Created on 26 Jun 2020  路  4Comments  路  Source: sharkdp/bat

I really like its theme which changes according to the language.

I use -p whenever I've to copy the content.

But I couldn't find an option to clear the content when quit or q.
You can take reference of less without any argument.

Please let me know in case of any confusion.

question

Most helpful comment

If I understand correctly, you want the screen to be cleared after you're done viewing the paged file and you press q?

If you use the latest version of less (less 551), that should work by default. If you don't, you can add this to the file listed by bat --config-file:

--pager='less -R`

That should make it clear the screen after you quit, but you will lose the --quit-if-one-screen behavior.

All 4 comments

If I understand correctly, you want the screen to be cleared after you're done viewing the paged file and you press q?

If you use the latest version of less (less 551), that should work by default. If you don't, you can add this to the file listed by bat --config-file:

--pager='less -R`

That should make it clear the screen after you quit, but you will lose the --quit-if-one-screen behavior.

I had bat 0.12.1 and had no bat --config-file available.

I upgraded the package to bat 0.15.4, according to #573 and worked like a pro.

Thanks.

But at any time, I want bat to give results as normal.

I did cat --pager="less" .zshrc but nothing happened.

I finally figured that the default pager is less i.e. "--pager="less -R" on 0.15.4

Was this page helpful?
0 / 5 - 0 ratings