3 ms·
Why not just "fd -e fi.md -X batcat"?
by 149765 3y ago
Why not just "fd -e fi.md -X batcat"?
- katehikes88 3y agoWhy not `find -name '*.fi.md' -exec less {} \;`
- genman 3y agoCan less provide syntax highlighting?
- katehikes88 3y agoIt can with lesspipe but don't you think that's a bit of an overkill for a simple markdown document?
- rwmj 3y agoSort 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.
- throwaway143829 3y agofind 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.
- katehikes88 3y agoThe 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.
- hiAndrewQuinn 3y agoGood first idea, and I just tried it - but sadly, this opens every Markdown document at once, as a giant pile of documents I would have to scroll down through. That's not what I'm after. I want to survey the whole page with my eyes as fast as possible for unusual colors / oddly short files / etc, then press `q` to have the screen totally clear and move on to the next one.