Adding Git Status Information to the ZSH Prompt - Tarneo's blog - eviltoast

I just thought this tutorial could genuinely be useful to some fellow ricers.

It explains not only the git status part of making a pure zsh prompt that looks like this:

  • bloopernova@programming.dev
    link
    fedilink
    English
    arrow-up
    8
    arrow-down
    1
    ·
    1 year ago

    Powerlevel10k also does git status very well. And supports custom defined sections too. I use one to print out the epoch time, and another to print time left in an auth session.

    • tarneo@lemmy.mlOP
      link
      fedilink
      arrow-up
      4
      arrow-down
      1
      ·
      1 year ago

      Yes. But p10k has many downsides:

      • requires using oh my ZSH, which alone is quite bad because of how much slower it makes the shell.
      • is a piece of software you’ll have to either install on each new device or have the software in your dotfiles. Bad practice. I very much prefer having no additional dependencies or overhead, plus the way I do it I can do whatever I want without the limitations of a prompt made by someone else, for which I’d have to dig in a lot of documentation. Compared to this, I only spent half an hour making a prompt exactly how I like, which doesn’t add overhead and doesn’t require a third party piece of software which I’d have to install on every new device.
      • bloopernova@programming.dev
        link
        fedilink
        English
        arrow-up
        6
        ·
        1 year ago

        p10k doesn’t require omz. You can install it by itself, the instructions are right there on the Github repo.

        On a new computer, I: git clone my dotfiles repo. Run the install script which symlinks all the relevant files, clones any needed repos like asdf, fzf, p10k, sources the .zshenv and .zshrc, runs asdf installs for my required tools, installs homebrew if on macOS, runs brew bundle to install everything else.

        Homebrew takes the longest. The rest is done in a few seconds.

          • bloopernova@programming.dev
            link
            fedilink
            English
            arrow-up
            1
            ·
            1 year ago

            Yes, nix is fantastic and I need to figure out the setup vs my current one. On a new system, would it be more straightforward to clone my repo, and then use nix, or just keep what I have? More of a rhetorical question there, I need to compare nix and homebrew based methods again (last time was like 2 years ago)

            There’s also the issue of nix darwin creating a partition, which the enterprise security department didn’t like me to do last time. Which is ridiculous, I agree! Plus homebrew is “approved” while nix is an unknown to our enterprise IT. They often block stuff in the name of security, I’d hate for nix to get halfway through setup and break.

  • yrmyli@sopuli.xyz
    link
    fedilink
    arrow-up
    1
    ·
    1 year ago

    You must be a mind reader or something because I have been looking for something like this for days :D I have used Starship and p10k but I don’t like them because I don’t really need 95% of their features + both of them slowdown my prompt.