# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.# Initialization code that may require console input (password prompts, [y/n]# confirmations, etc.) must go above this block; everything else may go below.if[[-r"${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"]]; t>
source"${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"fi
A software developer. I'm interested in learning new technologies and core language features. I love to dive into legacy code writing tests and refactoring as I go.
The reason I switched to zsh a few years back is that zsh's vi-mode can do visual whereas bash couldn't (can't?).
Cut&paste within your command line can be super handy, like when you, once again, forgot that git does parameters BSD style so no options after the argument, and you have to move either arguments or options.
A software developer. I'm interested in learning new technologies and core language features. I love to dive into legacy code writing tests and refactoring as I go.
set_prompt () {
if [[ "$?" == 0 ]]; then
PS1=""
else
PS1="\[\e[01;31m\]($?) "
fi
PS1+="\[\e[01;;34m\]\\\$\[\e[00m\] "
}
export PROMPT_COMMAND="set_prompt; history -a; history -c; history -r;"
It is very minimal. Either a $ or (1) $. I use screen and I have common directories already open using .screenrc. This helps me avoid jumping between directories a lot. I also don't really need to know what user or machine I am on. If I get confused there is a command to look it up.
And there I thought I was going for the bare minimum xD
I admire your workflow though, it seems pretty strict and probably comes with quite some efficiency.
A software developer. I'm interested in learning new technologies and core language features. I love to dive into legacy code writing tests and refactoring as I go.
It works for me. It may not be as useful for some users that want more info. I'm tempted to add the git branch but I'm not sure that I need it. I mostly use my IDE for git anyway except when I work on nixos.
My zsh is configured to be minimal, no fancy characters, no fancy features for git, just a plain prompt in the Gentoo style.
The only difference is the last character ($ in bash, % in zsh) which is either green or red depending on the last exit code.
I need to rely on the prompt, on its position and looks, so nothing with variable length except for the path (which only the shell itself can change).
Beyond the prompt however starts syntax highlighting for my command and everything, so it is really just the prompt that I want to be static as an anchor of sorts.
I have great experience in IT over 12 years: front / back - ends, mobile, system administration and deployment cycle. I implement effective and great software products.
A software developer. I'm interested in learning new technologies and core language features. I love to dive into legacy code writing tests and refactoring as I go.
But it's automagically set in my
.zhsrc
.at the top
and later on
That is nice! I never thought of displaying the powerlevel in PS1. I should try out zsh or maybe fish as well.
The reason I switched to zsh a few years back is that zsh's vi-mode can do visual whereas bash couldn't (can't?).
Cut&paste within your command line can be super handy, like when you, once again, forgot that git does parameters BSD style so no options after the argument, and you have to move either arguments or options.
I have this in my nixos configuration
It is very minimal. Either a
$
or(1) $
. I use screen and I have common directories already open using.screenrc
. This helps me avoid jumping between directories a lot. I also don't really need to know what user or machine I am on. If I get confused there is a command to look it up.And there I thought I was going for the bare minimum xD
I admire your workflow though, it seems pretty strict and probably comes with quite some efficiency.
It works for me. It may not be as useful for some users that want more info. I'm tempted to add the git branch but I'm not sure that I need it. I mostly use my IDE for git anyway except when I work on nixos.
My zsh is configured to be minimal, no fancy characters, no fancy features for git, just a plain prompt in the Gentoo style.
The only difference is the last character (
$
in bash,%
in zsh) which is either green or red depending on the last exit code.I need to rely on the prompt, on its position and looks, so nothing with variable length except for the path (which only the shell itself can change).
Beyond the prompt however starts syntax highlighting for my command and everything, so it is really just the prompt that I want to be static as an anchor of sorts.
Code over on GitHub.
${ret_status}%{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}
Which generates something like this in a git enabled directory:
A Unicorn Symbol, My Name, Current Directory, Current Git Branch.
Nothing Fancy :)
I've found the cool generator: bashrcgenerator.com
Very cool!