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 ( @nbailey@lemmy.ca ) English33•1 year agoI 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…
thelastknowngod ( @thelastknowngod@lemm.ee ) 2•1 year agoThis was me until the kubernetes transition occurred. Now I ssh into nothing unless it’s a personal box. I’ve become a zsh convert.
InputZero ( @InputZero@lemmy.ml ) 1•1 year agoI’ve been casually transitioning to kubernetes and zsh, but I’m just too comfortable with bash and my os running on bare metal. (He says with more than half his apps switched to containers.) It’s simple, effective, and is always available. I should take the plunge, someday.
thelastknowngod ( @thelastknowngod@lemm.ee ) 2•1 year agoFWIW, once I got deep enough into it, the thought of going back to the old way seemed like a crazy idea. I don’t want to manage servers like that again if it can be avoided. YMMV.
starman ( @starman@programming.dev ) English16•1 year agoYes, I use starship with nushell.
winety ( @winety@communick.news ) 4•1 year agoHow is Nushell? Is it stable?
starman ( @starman@programming.dev ) English1•1 year agoThere are some breaking changes made to config sometimes, it’s v0.x after all.
Hellfire103 ( @hellfire103@sopuli.xyz ) English15•1 year agoI use Zsh with the Oh My Zsh! framework, and I use a different theme depending on which subuserland I’m in, by customising
~/.zshrc
. For example, I use the gentoo theme on Debian and its derivatives, agnoster on NixOS, darkblood on Arch, strug for Mageia, apple on my macOS device, aussiegeek on FreeBSD, and gallifrey on OpenBSD. Different themes helps me remember which package manager to use and which distro-specific commands will work.I’ll send some screenshots in a bit, when I boot up my PC.
I like Zsh because of its tab completion and command history. I also quite like its plugins.
Before anyone asks, I have tried Fish before, and I prefer Zsh. I have tried configuring Bash before, and I prefer Zsh. I have played with Ksh and Tcsh on BSD, and I prefer Zsh. I used PowerShell a long time ago, and I prefer Zsh.
chayleaf ( @chayleaf@lemmy.ml ) 12•1 year agoI use fish + tide
I tried zsh+p10k before fish+tide, but zsh felt annoying in subtle ways that weren’t fixable with (existing) plugins, so I switched back to fish, but installed tide to mimic my previous p10k theme.
Fjor ( @Fjor@lemm.ee ) 4•1 year agoDidn’t know about Tide, super neat! ✨
Guenther_Amanita ( @Guenther_Amanita@feddit.de ) 10•1 year agoI just use the default fish without any modifications.
To be fair, I don’t use the terminal that often.
Even for my homeserver, I access most stuff (containers, updates, etc.) graphically with CasaOS (a web interface), and as a more “casual” PC user, I work with the tools given by my DE. I don’t do much fancy stuff.
And when I really need the CLI, fish is alright for me. It’s simple, has sane defaults, and feels (thanks to the automatically activated spell check and completion) very efficient for me.
Bash isn’t bad, but feels a bit lackluster. Zsh may be better, but requires too much configuration for what it’s worth for me.
z3bra ( @wgs@lemmy.sdf.org ) 9•1 year agoI’m on the boring side…
PS1="% "
I like it though, it gives me more room for commands !
Most of the pre-built prompts have two lines to give enough space for commands. The first line has all the info, and the second line is something like your prompt. If your prompt works for you, it’s great, though.
z3bra ( @wgs@lemmy.sdf.org ) 2•1 year agoBut I have more vertical space too ;)
That’s fair. Powerlevel10k actually has a very smart feature for this called transient prompt that removes the first line full of info from every executed command. It’s hard to explain. There is a screen recording in the README I have linked.
Cwilliams ( @Cwilliams@beehaw.org ) 1•1 year agoThat sounds really cool! Do you know if I could do with default zsh?
I’m sure you can since powerlevel10k is also written in pure zsh. I have no idea how to do it or how difficult it would be, however.
12510198 ( @12510198@lemmy.blahaj.zone ) English9•1 year agoI 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-----#
squid ( @squid@feddit.uk ) 7•1 year agoBash with blesh
And nano-syntax-highlighting
Cwilliams ( @Cwilliams@beehaw.org ) 1•1 year ago squid ( @squid@feddit.uk ) 1•1 year agoI’d also once switched to zsh but some of my scripts had failed to run so I’m back to bash, blue.sh is okay, mostly use it for auto-fill
Cwilliams ( @Cwilliams@beehaw.org ) 7•1 year agostarship.rs on zsh
30p87 ( @30p87@feddit.de ) 7•1 year agoAs 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:- Terminal/TTY number in orange
- Username in green (for roots .bashrc it’s red)
- Hostname in green
- Current working dir in blue
- Current git branch in yellow (if in a git repo)
- Exit code in red (if not 0)
Looks like this:
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.
happyhippo ( @happyhippo@feddit.it ) 6•1 year agoI tried oh-my-bash with some fancy theme, but went back to plain old bash from my distro since suggestions for autocomplete had suddenly started to lag. Went back to default and it’s as quick as ever to suggest.
I’m not willing to trade efficiency for bells and whistles
I don’t know about oh-my-bash themes, but on the zsh side, the powerlevel10k can display a lot of information without any lag due to asynchronous implementation. I’m sure there is something similar for bash too.
Polyester6435 ( @Polyester6435@lemmy.blahaj.zone ) 5•1 year agoVanilla 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
theshatterstone54 ( @theshatterstone54@feddit.uk ) 5•1 year agoCurrently, I use starship, but I have considered switching to a regular PS1 or similar setup, it’s just that I can’t get the colours right when using PS1.
rutrum ( @rutrum@lm.paradisus.day ) English4•1 year agoWhen 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.
palordrolap ( @palordrolap@kbin.social ) 4•1 year agoStandard Bash with a twist:
[ /full/path/~-prefixed where possible ] user@short-hostname $ _
(Underscore = cursor, not part of prompt, in case that’s not obvious.)
It’s similar enough to the most common Bash prompt that I don’t feel totally alienated on a different system but different enough to be unique / useful.
The carriage return is deliberate. Paths can often get quite long in my homedir (if not other places), even with the
~
abbreviations. I can’t imagine anyone likes starting to type a command more than halfway across a screen because of a long path; this was my solution.The spacing is deliberate too. The brackets are hard to distinguish without the spaces either side of the path. On the second line, the 1-char indent and the spaces around the obligatory
$
were the layout I found most pleasing.There are embedded colour codes, but it’s designed so that it looks fine without them, just in case.
As for other configuration, I use whatever comes with the distro I’m using, especially any command-completion, etc.
not_amm ( @not_amm@beehaw.org ) 1•1 year agoHow did you do it? I’ve been wanting to do that, but I’ve been busy and haven’t had the time 😿