‹ BackHN Continuity

Thread

Small programming tricks

681 points · 294 comments · signa11

  1. phforms · · focus · HN ↗
    The thing with a lot of these tricks is that you have to get into the habit of using them. I knew `Ctrl+r` for history since I learned about the command line. I even have a nice shell integration with fzf. But I still used the up/down arrow keys for years or scrolled up when I was looking for a previous command, because I never remembered the shortcut and just took the path of least resistance to find something.

    Usually what I do is writing these tricks down to a document that is easily accessible at a place where I know that I will look for when failing to remember them. I have a directory of docs where I write stuff like this down by language/tool/etc., so I can quickly look it up without having to search the internet. But I also have to actively remind myself that these things exist whenever I have a problem, stop me from just doing the inefficient thing.

    1. quirino · · focus · HN ↗
      atuin kind of fixes this habit, when you click up you get a list of the latest commands, and you can just start typing to search. It's extremely natural.
      1. ChickeNES · · focus · HN ↗
        I found atuin way too hard/slow to use, I think I went two days before I nuked it and went back to pure omzsh. Has it gotten any better in the past 2ish years?
        1. ellieh · · focus · HN ↗
          (hi! I work on atuin!)

          yes, it's improved a lot in the last couple of years! what in particular bothered you?

          1. saghm · · focus · HN ↗
            Not the parent commenter, but I also tried it a year or two ago and my recollection is that I had a similar experience. I have a really long history file that dates back like a decade and if remembering correctly I tried to import it, and it made using my shell very laggy so I ended up removing it. I'm not 100% positive that I'm remembering the exact way that I started experiencing the lag though, so if I have time tomorrow I'll try it out again and see if it's still something I encounter.
            1. ellieh · · focus · HN ↗
              Ahh yes, we’ve done a lot of performance optimisation since then. We regularly test on >1m records and have no issues

              Make sure you’re using the daemon (the install script will handle this) and you should be good to go

              Very happy to help if you have any problems. Ellie at Atuin dot sh

              1. ChickeNES · · focus · HN ↗
                I'm curious, is using the daemon with my own frontend a supported use case? Because I had a thought...while as I mentioned above I don't use the CLI much anymore...my agents do, and having that history in a sql db would be mighty useful...

                Edit: Okay, y'all are literally working on exactly what I need to build off of, perfect lmao

                1. ellieh · · focus · HN ↗
                  we actually have an mcp built on top of this that you can use, no problem!
Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.