Better Shell History Search
tratt.net
tratt.net
So for example, I have one that I use to run software updates:
softwareupdate --include-config-data --install --all --restart # system:update:restart
I have a similar one without the `--restart` option that I tag with `:norestart` instead, but you get the idea—I put related commands under a common term.Then I can just use the ctrl-r builtin keybinding, type `:system` and cycle through system related commands, or go exactly to the command I want. The beauty of this is that it also works in bash and systems I remote into (which I frequently need to do at work), without any extra plugins required.
[1]: interactive comments are disabled by default in zsh, but can be enabled with `setopt interactive_comments`
However, the fuzzy search in Atuin is worse than fzf, which was a downgrade. It just has less effective heuristics/scoring, e.g. it might find the individual letters of a short command scattered in a command that had a long base64 input or something.
https://docs.atuin.sh/configuration/config/#fuzzy-search-syn...
Bash has a hook (cannot remember the name on my phone) that is called on every command.
It's easy enough to write into a file the command together with the directory and git branch.
Then I can grep it with a bash function that colors the dir and branch in the output.
It does not replace ctrl-r but it's a great addition especially when running multiple sessions and bash saving just the last one
$PROMPT_COMMAND
https://www.gnu.org/software/bash/manual/html_node/Bash-Vari...
trap 'echo "$BASH_COMMAND" >> ~/.bash_history_extra' DEBUG
this runs before commands, not after the whole command line (before prompt is displayed).
my personal bash history tweak suit is based on this. with a load of complexity of course, because the DEBUG trap is also triggered before each PROMPT_COMMAND commands and on every simple command within the issued command line. so the above example would record each command of a pipeline separately.
Decades have passed and HN still can’t automatically dedup submissions.
I'd think the submissions from two days ago (206 points, 93 comments) would have qualified. (It's the exact same URL so that's not why it wasn't de-duped either.)
https://hn.algolia.com/?dateRange=all&page=0&prefix=true&que...
But there's times when I've submitted items that are dupes and it just takes me to the recent submission and adds an upvote. Now here's something weird: I just tested this by submitting the URL from this submission with the same title and it immediately took me to the discussion from two days ago.
So I'm really confused how this dupe got through.
alias hst=“history | fzf”
Not nearly as feature full but the simplicity of it makes me happy :)(source: I have written unit tests against different versions of awk. That was... unpleasant.)
Good to know about skim as an fzf alternative.