Hacker News new | ask | show | jobs
by sundarurfriend 244 days ago
bat is one of the few "new wave" tools that I install without hesitation, with no worries about stability issues or silent downsides. It has great defaults that make it feel like it always does the right thing for the context, just an unambiguous enhancement to my terminal experience.
4 comments

I probably have a bunch of such tools installed on my main machine. The problem is you actually need to remember to use them, and then maybe their command line switches to get the desired output. Whereas cat/less/git/vim are muscle memory. Not to mention that you first need to get over the hum of installing them in your system, likely needing to grab the latest Go/Rust/Zig toolchain along the way.

So while I admire the engineering effort, I still find utility of these tools limited.

I’m in the same boat with a lot of these tools, but bat is different in that it’s compatible enough to be safe to alias to the command it's replacing[1]. You can continue to use cat as usual, with the benefit of getting syntax-highlighted output.

[1]: Assuming you use the `--paging=never` flag in your alias as the README suggests.

brew usually manages to install these tools for me with no problems. And on the memory point, there's always `alias` or adding a symlink in ~/.local/bin. But, yeah, I have the exact same problem remembering to use `eza`. For some reason, I don't find `bat` as much of a problem; ls is probably more ingrained.
Just alias them in your shell config. You don't have to remember to use them if you have more and less just be aliases to bat. Same thing I do with eza, the ls replacement -- "ls" calls eza.
I use fish’s abbreviations instead of aliases. That way I get control and visibility into the change, but can also gradually learn it too :)
Agreed. I use this program all day, every day. Viewing a file without it now is just painful. :-)

I have these aliases, which are useful when piping output to them:

    alias bd='bat -p -l diff'
    alias bh='bat -p -l help'
    alias bi='bat -p -l ini'
    alias bj='bat -p -l json'
    alias bl='bat -p -l log'
    alias bm='bat -p -l man'
    alias by='bat -p -l yml'

     alias bat='rview'

rview from vim, OFC.

Problem solved, you don't overwrite the files, you get all the vim options and a much better syntax highlighting.

Oh, and, as a plus, you gain xxd, which can be useful in tons of contexts.

> It has great defaults that make it feel like it always does the right thing for the context

Just tried it out yesterday and it by default output white text on my white background terminal. :(

any other recommendation?
Along with bat, these are my main ones that I install always:

fd, a better find: https://github.com/sharkdp/fd

ripgrep (rg) a modern grep: https://github.com/BurntSushi/ripgrep

eza for ls replacement: https://github.com/eza-community/eza

duf is a cleaner df: https://github.com/muesli/duf

dust for du: https://github.com/bootandy/dust

Also fish + starship + yazi + helix, all of which mostly work perfectly with the defaults

"A breadth-first version of the UNIX find command" -- https://github.com/tavianator/bfs
I stopped using eza and lsd in favor of aliasing nushell's ls command.

I guess it's not worth the entire dependency of nushell if you don't see yourself ever dabbling with it in other ways (you should it's sick).

Also I'd add to your list zoxide

I've aliased cat to bat, cd to zoxide, and ls to nushell ls with zero issues.

I've started writing all of my scripts in nushell (unless It's critical that they keep working long-term without maintenance). It's incredible, and improving fast.
What is helix? Haven't heard of it before, I don't think.
Helix is a Vim/Kakoune-inspired modal editor, with a bunch of stuff built in by default. For example it has support for a huge amount of LSPs and intergrates them automatically.

It's command structure is also super similar to Vim's, but, basically, "flipped" around. So you wouldn't write "dw" to delete a word, but "wd". This means that you can see whatever you're selecting to be deleted highlighted before you actually execute the deletion. It has a bunch of saner commands also for stuff people usually want to do, like go to definition/usage, and honestly for people who aren't Vim-addicts such as myself, it's probably a good idea to check it out once, to see if it's a good fit for you.

I tried getting into nvim (handy for editing from the CLI or over ssh), but within weeks the plugin system started getting weird errors.

Then I tested Helix[0] when a friend suggested it and it Just Works. Along with LSP support that just picks up language servers automatically if you install them.

The target-action command style takes some getting used to after (n)vim's action-target style, but I actually prefer it now.

[0] https://helix-editor.com

fwiw, the plugin system doesn't magically just get "weird errors", its always some form of user negligence.
I literally didn’t touch it and it started throwing errors :)
Zsh > fish for me. It's about script compatibility.
All my scripts start with #!/bin/bash

Zero issues with compatibility

super useful list, you probably should expand it into a blog post