3 ms·
They are referring to using cat to print out a file to the terminal. I'm not sure that's a "misuse", but personally I've never done it, using "more" or "less" i
by jhbadger 7y ago
They are referring to using cat to print out a file to the terminal. I'm not sure that's a "misuse", but personally I've never done it, using "more" or "less" instead. "bat" really is a replacement for more/less, only with additional features such as syntax highlighting in source code.
- johnisgood 7y agoI use: cless() { pygmentize -O style=<style> "$1" 2>/dev/null | less } I have programs that depend on pygmentize so I am not sure I will use bat anytime soon when I already have pygmentize and less, or at least not for it having syntax highlighting.
- pcr910303 7y agoThat use is the exact reason why LESSPIPE exists, check out man less & https://www-zeuthen.desy.de/~friebel/unix/lesspipe.html https://www-zeuthen.desy.de/~friebel/unix/lesspipe.html
- johnisgood 7y agoMaybe, but I already had pygmentize, I already had less, and this small function took me less than 10 seconds to type in and start using immediately (and I use a particular style that pygmentize provides so that is a plus). :P In any case, thanks for sharing.
- pcr910303 7y agoOh, I forgot to mention that LESSPIPE is a mechanism to automatically pipe the contents of a file when opening in less, and that the linked LESSPIPE script has an option to use pigmentize for syntax highlighting. It’s a tool for enhancing less & pygmentize, not replacing them. Well, just providing info for everyone. I’m not trying to force you using that script :-)
- johnisgood 7y ago> Well, just providing info for everyone. I’m not trying to force you using that script :-) Yeah of course, sorry, I admit my comment did seem defensive! Thank you for sharing, really. :)
- saagarjha 7y agoI just use nano -v.