Skip to content

The shell prompt appearance conception called Bar.

License

Notifications You must be signed in to change notification settings

anki-code/bar-theme

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bar theme

Features:

  • It looks not like Christmas tree. Most of themes (omz examples) look like Christmas garland and frustrate attention 🎄 💈. But terminal is most for write commands and get output, not for color juggling 🖥

  • It has three attention aspects by priority: first - command and path, second - output, third - pills/sections 👓

  • It has a bar along all space and it is a great separator ⬛️

  • The command beginning has fixed position and command has color with intensity. It's great for reading and typing 💚

  • The pills/sections placed to right but not in RPROMPT and it allows you to secure copy the command and output without environmental disclosure 🔒

  • The pills/sections can have additional background or color accent if you need 💊

Appearance

zsh bar theme

Screeshot from Hyper with Fira Code or something like this.

Use xontrib-prompt-bar

git clone https://github.com/anki-code/zsh-bar-theme ~/.oh-my-zsh/custom/themes/zsh-bar-theme
ln -s ~/.oh-my-zsh/custom/themes/zsh-bar-theme/bar.zsh-theme ~/.oh-my-zsh/custom/themes/bar.zsh-theme
sed -i  's/^ZSH_THEME=/ZSH_THEME="bar"\n#ZSH_THEME=/g' ~/.zshrc
zsh
  1. .zshrc settings:
POWERLEVEL9K_VISUAL_IDENTIFIER_EXPANSION=
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(user host dir newline prompt_char)
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(vcs command_execution_time background_jobs virtualenv anaconda pyenv nodenv nvm nodeenv rbenv rvm kubecontext terraform nordvpn ranger time newline)
POWERLEVEL9K_TIME_FORMAT='%D{%y-%m-%d %H:%M:%S%z}'
POWERLEVEL9K_BACKGROUND=234
POWERLEVEL9K_PROMPT_CHAR_BACKGROUND=
POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_BACKGROUND=234
POWERLEVEL9K_USER_FOREGROUND=244
POWERLEVEL9K_HOST_FOREGROUND=244
POWERLEVEL9K_ANACONDA_FOREGROUND=244
POWERLEVEL9K_VCS_FOREGROUND=244
POWERLEVEL9K_TIME_FOREGROUND=244
zle_highlight=( default:fg=green,bold )
  1. Also you can try the proof of concept config p10k-bar.zsh. It work but not recommended because it disable many p10k features.

bash PoC

trap 'echo -ne "\e[0m"' DEBUG
function prompt_command {
        local l="`hostname` `whoami` `pwd`"
        local r="`date --rfc-3339=sec`"
        local ls=${#l}
        local rs=${#r}
        let ss=$COLUMNS-$ls-$rs-2
        local sp="`printf %${ss}s | tr ' ' ' '`"
        echo -e "\n\e[48;5;234m$l $sp $r\e[0m"
}

export PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND ;} prompt_command"
export PS1='\$ \[\033[01;32m\]'