Hi. I’ve been using powerlevel10k for a long time, but a few days ago, I decided I wanted to customize it a bit. I opened the .p10k.zsh file, and I was shocked. It’s really massive, with TONS of options. I’ve been digging through for a few hours already, and it’s absolutely amazing how much you can customize it without actually programming anything. I was wondering what other people are using. So my questions are:

  • Do you customize your shell prompt?
  • If yes, do you use some framework or pre-made theme, or do you just configure it the vanilla way in your bashrc/zshrc/…
  • How is your experiences with it so far?
  • Share screenshot of your prompts, please (Sadly, my prompt is currently half done, so I can’t really share it)
  • nbailey@lemmy.ca
    link
    fedilink
    English
    arrow-up
    21
    ·
    11 months ago

    I use plain old bash with the plain old .bashrc that ships with Debian. I’ll bolt on a git-branch-aware function into the prompt here and there, but that’s about it.

    Why? I ssh into a few dozen machines most days and my shitty little lizard brain can’t deal with everything being different on each box. So as much as I appreciate zsh, powerline plug-ins, all that glitzy stuff, I’ll be a late adopter when it comes to plain old Debian stable…

    • herrvogel@lemmy.world
      link
      fedilink
      arrow-up
      3
      ·
      11 months ago

      I wrote an Ansible playbook to install my zsh stuffs into a remote machine. I don’t run it against every machine though, just the ones where I ssh into particularly often and have the freedom to customize the shell.

      • whatwhatwhatwhat@lemmy.world
        link
        fedilink
        arrow-up
        2
        ·
        11 months ago

        freedom to customize the shell

        This is always the issue for me – I ssh into several machines for various clients every day. All of those clients have one thing in common: equally strict and inconsistent policies about what packages you can use from where and for what reason. “I like this shell better” would never fly, sadly.

    • sep@lemmy.world
      link
      fedilink
      arrow-up
      3
      ·
      11 months ago

      The only way i function. Am usualy ssh’d into 3-5 machines at any given time.

  • 12510198@lemmy.blahaj.zone
    link
    fedilink
    English
    arrow-up
    10
    ·
    11 months ago

    I designed this prompt shortly after I switched to Linux, I’ve been using it for a while, it has a few features like putting the exit code if it isn’t 0, changing the hostname color if its detected that you are over ssh, changing the directory color to red if it isn’t writeable, changing the prompt color to red if your euid is 0, and instead of printing I have no name! when your user does not have an entry in the passwd file, it will just print your uid in red. I also have a version that I wrote in C that works the same way with a subsitution shell, but it was harder to sync across all my devices when I made a change, so I rewrote it in posix shell that could be synced with just my .bashrc and work almost anywhere.

    I don’t know how to post a screenshot, sorry for the long paragraph, but here is the source code, feel free to share or do whatever with it!

    #-----PS1-----#
    BOLDRED="\001\033[1;31m\002"
    BOLDBLUE="\001\033[1;34m\002"
    BOLDPURPLE="\001\033[1;35m\002"
    BOLDCYAN="\001\033[1;36m\002"
    BOLDGREEN="\001\033[1;32m\002"
    COLORRESET="\001\033[0m\002"
    CURSOR_BLINK="\001\033[5 q\002"
    INFO_COLOR=$BOLDGREEN
    SUPERUSER_COLOR=$BOLDRED
    NORMALUSER_COLOR=$BOLDCYAN
    SSH_COLOR=$BOLDPURPLE
    __shellprompt ()
    {
            if [ "$(id -u)" = 0 ]; then
                    PROMPT_COLOR=$SUPERUSER_COLOR
                    PROMPT_EMBLEM='#'
            else
                    PROMPT_COLOR=$NORMALUSER_COLOR
                    PROMPT_EMBLEM='$'
            fi
            # [user@hostname]
            printf "%b%s%b" "${PROMPT_COLOR}[${INFO_COLOR}" "$(whoami 2>/dev/null || (printf "%b%s" "${BOLDRED}" "UID:$(id -u)"))" "${PROMPT_COLOR}@"
            if [ -n "${SSH_TTY}" ] || [ -n "${SSH_CLIENT}" ]; then
                    printf "%b" "$SSH_COLOR"
            else
                    printf "%b" "$INFO_COLOR"
            fi
            printf "%s%b" "$(hostname)" "${PROMPT_COLOR}]"
            # :
            printf "%b" "${COLORRESET}:"
            # (/pwd)
            printf "%b" "${PROMPT_COLOR}("
            if [ -w "$PWD" ]; then
                    printf "%b" "${INFO_COLOR}"
            else
                    printf "%b" "${BOLDRED}"
            fi
            if [ -n "$HOME" ] && [ "$HOME" != "/" ] && { [ "$PWD" = "$HOME" ] || [ "$PWD" != "${PWD#"$HOME/"}" ]; }; then
                    printf "%s" "~${PWD#"$HOME"}"
            else
                    printf "%s" "${PWD}"
            fi
            printf "%b" "${PROMPT_COLOR})${COLORRESET}"
            # :(EXITCODE)
            if [ "$1" != 0 ]; then
                    printf "%b" "${COLORRESET}:"
                    printf "%b%s%b" "${PROMPT_COLOR}(${BOLDRED}" "${1}" "${PROMPT_COLOR})${COLORRESET}"
            fi
            # ->$
            # ->#
            printf "%b" "\n${PROMPT_COLOR}->${PROMPT_EMBLEM} ${COLORRESET}${CURSOR_BLINK}"
    }
    export PS1='$(__shellprompt $?)'
    #-----PS1-----#
    
  • dinckel@lemmy.world
    link
    fedilink
    arrow-up
    9
    arrow-down
    1
    ·
    edit-2
    11 months ago

    Fish, with Starship. It does everything I need it to, completely unmodified. In comparison, zsh barely reached feature parity with a dozen plugins, and I just don’t want to spend my time on that

  • Free Palestine 🇵🇸@sh.itjust.works
    link
    fedilink
    arrow-up
    6
    ·
    11 months ago

    I’ve been using zsh for some time, but I finally switched to fish. I also checked out Nushell, it lacks some features, but it’s really interesting. On zsh I was using Powerlevel10k, on Fish I used oh-my-fish with the shellder theme before I switched to Starship. I’m very happy with this setup. My prompt looks like this:

    My Terminal Emulator of choice is kitty, the font is Monocraft.

  • Polyester6435@lemmy.blahaj.zone
    link
    fedilink
    arrow-up
    5
    ·
    edit-2
    11 months ago

    Vanilla zsh prompt. I had a thing that told me which git branch I was on for a while but my editor tells me that so I decided I didn’t need it

  • pete_the_cat@lemmy.world
    link
    fedilink
    English
    arrow-up
    4
    ·
    11 months ago

    I’m old school, I use Bash and do the basic " [user@hostname working-directory]$ " but there’s a newline before the first bracket so there’s always a line break and an indent after STDOUT so I can tell where the command output ends if it’s huge. I also tend to colorize it a bit.

    I’ve tried ZSH and I like it, but as a Linux System Engineering overseeing thousands of servers, they all use Bash, so that’s what I’ve stuck with as well.

  • Drito@sh.itjust.works
    link
    fedilink
    arrow-up
    4
    ·
    11 months ago

    I customize the shell prompt in the PS1 variable. Its unpleasant to work with that unreadable language, but I do that once for years and I reuse it across distros.

  • 30p87@feddit.de
    link
    fedilink
    arrow-up
    4
    arrow-down
    1
    ·
    edit-2
    11 months ago

    As I use bash basically for everything, I wanted my prompt to be as basic as possible (No newlines, fixed format) and compatible across my PC, Laptop as well as server and Pi via SSH.
    Therefore, it’s a simple __prompt_command function in my .bashrc (nearly) everywhere.
    It’s structured as:

    1. Terminal/TTY number in orange
    2. Username in green (for roots .bashrc it’s red)
    3. Hostname in green
    4. Current working dir in blue
    5. Current git branch in yellow (if in a git repo)
    6. Exit code in red (if not 0)

    Looks like this: 1000011281

    I used some prompt generator to get the variables and colors right, and then wrapped parts in if-then where needed.
    The result is:

    __prompt_command() {
        local EXIT="$?"
        PS1="\[\033[38;5;216m\](\l)\[$(tput sgr0)\] \[$(tput sgr0)\]\[\033[38;5;85m\]\u@\H\[$(tput sgr0)\]:\[$(tput sgr0)\]\[\033[38;5;68m\][\w\[$(tput sgr0)\]"
        local GIT_BRANCH="$(git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/')"
        if ! [[ -z "$GIT_BRANCH" ]]; then
            PS1+=":\[$(tput sgr0)\]\[\033[38;5;142m\]${GIT_BRANCH}\[$(tput sgr0)\]"
        fi
        PS1+="\[\033[38;5;68m\]]\[$(tput sgr0)\]"
        if [ $EXIT != 0 ]; then
            PS1+=":\[$(tput sgr0)\]\[\033[38;5;1m\]${EXIT}\[$(tput sgr0)\]"
        fi
        PS1+="\\$ \[$(tput sgr0)\]"
    }
    

    In practice I use every aspect of it. The terminal number is useful for sorting, the username is needed especially when handling e.g. git or db servers with specific users, and one has a terminal as the user, one as root and one as normal user. Hostname is obviously important with multiple ssh sessions open all the time (especially without terminal emulator titles). Typing pwd all the time would be very tedious, as I only move around my system in bash, so having it in the prompt is nice. If I am in a git repo I also need to know the branch and otherwise it’s not displayed anyway. Quickly identifying silently failed commands is tedious, especially because issuing one command overwrites $? again, so ‘logging’ it if necessary is nice.

  • rutrum@lm.paradisus.day
    link
    fedilink
    English
    arrow-up
    3
    ·
    edit-2
    11 months ago

    When I hopped on the home manager train I enabled starship (since it was just a couple lines to add) and I’m very happy with it. It has a couple small things out of the box that I really want. Mostly, its trimming my path so it doesnt take the full width of my terminal. I have it set so it only prints the lowest 3 directories and it wont print any directory higher than the current git repo Im in. IMO i hate all the little emojis but that was very easy to remove/disable. Its a very clean experience, and straightforward config (toml if not using nix).

    EDIT: here’s a pic of the path trimming. This is about as complicated as it gets. Also, I’m using catpuccin color scheme in urxvt.

  • davefischer@beehaw.org
    link
    fedilink
    English
    arrow-up
    2
    ·
    11 months ago

    VERY simple. Time & node:

    HH:MM node%

    Except in the xterm I keep open for dealing with my camera. That’s time & last-word-in-cwd:

    HH:MM dir%

    Sometimes on a cellphone I will use battery charge percent:

    BB%

    And when I’m su’ed it’s just:

    root%

  • doomkernel@sopuli.xyz
    link
    fedilink
    arrow-up
    2
    ·
    11 months ago

    I use oh-my-posh (on a windows machine) with a custom theme that tells me some git info and a few other things. But when I’m in my Linux machine its a vanilla zsh

  • chayleaf@lemmy.ml
    link
    fedilink
    arrow-up
    2
    ·
    11 months ago

    I use fish + tide

    I tried zsh+p10k before fish+tide, but zsh felt annoying in subtle ways that there fixable with (existing) plugins, so I switched back to fish, but installed tide to mimic my previous p10k theme.

  • vettnerk@lemmy.ml
    link
    fedilink
    arrow-up
    2
    ·
    edit-2
    11 months ago

    I used variations of the same homecooked bash prompt ever since my FreeBSD days 25 years ago, up until Parrotsec made me realize that a prompt doesn’t have to be confined to one line.

    So now I use:

    username@host:/full/path #
    :

    …with a bunch of colors and special characters to make it more readable at a glance. That colon represents the input line.

    To conserve some space I only used last part of CWD before, but now that it’s multiline I can use the full path, making it easier when I need to copy-paste an scp-friendly path, as I’m usually working across a bunch of different usernames and hosts.