Hacker News new | past | comments | ask | show | jobs | submit login
bat, a cat(1) clone with syntax highlighting, Git integration written in Rust (github.com/sharkdp)
40 points by tosh on Oct 21, 2020 | hide | past | favorite | 6 comments



> "bat" is not a better version of cat, it's a completely different tool. cat is short for concatenate. If you want to view a file use less, and if you want syntax highlighting etc. then use view (comes with vim).[1]

[1] https://news.ycombinator.com/item?id=17879419

---

I personally have this in ~/.bash_profile:

  cless() {
    pygmentize -O style=monokai "$1" 2>/dev/null | less
  }
Then if I want syntax highlighting with less, I just type cless <path>.


This is nifty but my work computer's Python interpreter takes so long to even start, let alone import all its modules, that your command is slightly impractical for me.

real 0m8.371s user 0m2.608s sys 0m0.679s

This isn't the first place I work where Python's startup time has been like this. Perhaps it's because all the binaries are on NFS? I don't know.


You are right, I do experience some startup time issues as well. There might be an alternative to pygmentize that is faster and supports many color themes, I am not sure! Someone might help us out.


When I saw the headline, my first thought was: I’m actually trying to get out of the habit of cat’ing to view files.

Head or tail to leave a peak in the terminal history or less to actually read the file, seems to me to be a much better habit.

Thanks for the great tip on cless - I might just extend it to a chead and ctail !


Am I the only one who prefersmy lean and clean Unix commands to stay lean and clean?

For everything else I already have emacs...





Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: