5 ms·
That has git integration, like bat does? That shows non-printable characters like bat does? That allows you to concatenate and page multiple files at once like
by freddie_mercury 1y ago
That has git integration, like bat does? That shows non-printable characters like bat does? That allows you to concatenate and page multiple files at once like bat does? That supports the --line-range option like bat does? You can pipe the output of tail -f through your alias?
I guess if all you did was read the headline of the post you could assume your alias does all the same things as bat.
- feelamee 1y agolooks like you are right, but... I almost never used all of this features with bat. Maybe tail -f sometimes. Do you really need this in daily workflow?
- freddie_mercury 1y agoI use the syntax highlighting of manpages, fd, ripgrep, and git pretty regularly. I also use the fzf previewer with --range-limited pretty frequently.
- petepete 1y agoIt's clearly a joke in the vein of being able to recreate Dropbox with an FTP account, curlftpfs, and SVN/CVS.
- hnlmorg 1y agoNot the GP and I do like bat, but to answer your questions: > That shows non-printable characters like bat does? cat does actually support that via the flags with -v (you can also use -t and -e to view tab and line endings too) > That allows you to concatenate and page multiple files at once like bat does? cat is literally called “cat” because it’s intended purpose is concatenation. It’s not a pager though the GPs example did pipe to less anyway. > That supports the --line-range option like bat does? ‘tail’ and ‘head’ would be muscle memory to a lot of people and not that different in terms of number of keystrokes. But I do take your point that it’s nice to have that built into your pager. > You can pipe the output of tail -f through your alias? I couldn’t see why not. tail -f isn’t doing anything weird with the fd. ——— I’m not arguing against using bat though. I have it aliased to cat on my own machines, so I clearly and would recommend bat. But I do think some people might be surprised how far you can get with coreutils if bat wasn’t available
- em-bee 1y agohighlight is not part of coreutils either. at least not on fedora.
- hnlmorg 1y agoNot in any OS. In fact I hadn’t even heard of it before yesterday. But I’ll be looking into it now I know.
- freddie_mercury 1y ago>> That allows you to concatenate and page multiple files at once like bat does? >cat is literally called “cat” because it’s intended purpose is concatenation. cat's behaviour and bat's behaviour is different, though. >cat a.txt b.txt It was a dark and stormy night. Once upon a time. >bat a.txt b.txt ───────┬────────────────────────────────────────────────────── │ File: a.txt ───────┼────────────────────────────────────────────────────── 1 │ It was a dark and stormy night. ───────┴────────────────────────────────────────────────────── ───────┬────────────────────────────────────────────────────── │ File: b.txt ───────┼────────────────────────────────────────────────────── 1 │ Once upon a time. ───────┴────────────────────────────────────────────────────── This difference becomes more useful once we have a more meaningful example: >cat *.py (thousands of lines of output) >bat -r :5 -H 2 --style full *.py ───────┬────────────────────────────────────────────────────── │ File: __init__.py <EMPTY> │ Size: 0 B ───────┴────────────────────────────────────────────────────── ───────┬────────────────────────────────────────────────────── │ File: editor.py │ Size: 2.4 KB ───────┼────────────────────────────────────────────────────── 1 │ import collections 2 │ import contextlib 3 │ import glob 4 │ import io 5 │ import os.path ───────┴────────────────────────────────────────────────────── It's hard to imagine many people have the muscle memory for the combination of cat, head, and whatever else you need to add headers with the filename and file size, call out empty files, highlight the second line, show line numbers, do syntax formatting, and wrap to the terminal width (head doesn't do this).