Hacker News new | ask | show | jobs
by katehikes88 851 days ago
Why not `find -name '*.fi.md' -exec less {} \;`
2 comments

find is pretty slow compared to fd. It also spends a lot of time searching through directories like .git or node_modules which you typically want to exclude.
The bottleneck for speed will be the human examining the documents so there really isn't any difference in the overall time spent. Even without the required human input it doesn't make much difference for such a small amount of files. Most of the time there isn't a much reason to use `fd` or `rg` over more standard tools. Often you get most of the benefit from a single `cd`. When making a script for general consumption and there are possibly larger collective time savings from excluding subdirectories it would make more sense to use `-prune` rather than a niche tool with default rules that might change in the future.
Can less provide syntax highlighting?
Sort of. Setting the LESSOPEN environment variable will filter less input through that, which could do syntax highlighting (if you use less -r).

The default (/usr/bin/lesspipe.sh, shipped with less) isn't very clever. It can uncompress files in some common formats and open images, but isn't very smart and doesn't handle markdown or code of any kind as far as I can tell.

It can with lesspipe but don't you think that's a bit of an overkill for a simple markdown document?