Hacker News new | ask | show | jobs
by mkdirp 1539 days ago
If you're running zsh, I suggest using powerlevel10k[0]. It is stupid fast, and extremely customisable.

[0] https://github.com/romkatv/powerlevel10k

3 comments

P10k is one of those revelations that feels “next generation”. Trying to back to anything else is very painful for me, even things that are supposed to be “fast” like starship.
For p10k users, adding extra info to your prompt is really easy. Here's my epoch-seconds display:

    function prompt_epoch() {
      MYEPOCH=$(/bin/date +%s | sed ':a;s/\B[0-9]\{3\}\>/,&/;ta')
      p10k segment -f 66 -t ${MYEPOCH}
    }
It looks like this in action:

https://i.imgur.com/0IT5zXi.png

In the spirit of p10k speed, you can perform that task without forks:

    $ zmodload -F zsh/datetime p:EPOCHSECONDS
    $ printf "%'d" $EPOCHSECONDS
    1,648,943,504
Do you know how to do that printf within a zsh variable? i.e. here:

    function prompt_epoch() {
      p10k segment -f 66 -t ${MYEPOCH} <-- replace MYEPOCH with EPOCHSECONDS but with commas?
    }
EDIT: printf can assign output to a variable using -v. Therefore my function can be rewritten as:

    function prompt_epoch() {
      printf -v COMMA_EPOCH "%'d" ${EPOCHSECONDS}
      p10k segment -f 66 -t ${COMMA_EPOCH}
    }
Nice, thank you!
Your imgur link isn't working for me. I'm getting an "oops we can't find the image".
I've been using Pure for a handful of years now. I just want pwd, git and vi status, and prompt on its own line, and it does it all. Available on both zsh and fish, I seem to remember a Powershell port as well, if that's your style.
I used to use Pure a couple of years ago. I found it had some weird bugs that were really annoying, not very reproducible and my shell knowledge was not nearly good enough to debug it. I think especially the async stuff was very error-prone. Maybe that’s changed now.

Powerlevel10k is very customisable, faster, can be configured to function exactly like Pure out of the box and in my experience, more reliable.

I would recommend powerlevel10k over Pure any day. But it’s just an anecdotal datapoint.

Yeah, maybe. I'm just really lazy.

Edit: Well that was easier than expected, their initial setup daemon is pretty well made, and the "instant prompt" is pretty cool. Feels snappy.