Shell theme based on bira
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

JJ in zsh theme

+85 -12
+85 -12
mira.zsh-theme
··· 2 2 local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" 3 3 4 4 if [[ $UID -eq 0 ]]; then 5 - local user_host='%{$terminfo[bold]$fg[red]%}%n@%m %{$reset_color%}' 6 - local user_symbol='#' 5 + local user_host='%{$terminfo[bold]$fg[red]%}%n@%m %{$reset_color%}' 6 + local user_symbol='#' 7 7 else 8 - local user_host='%{$terminfo[bold]$fg[green]%}%n@%m %{$reset_color%}' 9 - local user_symbol='$' 8 + local user_host='%{$terminfo[bold]$fg[green]%}%n@%m %{$reset_color%}' 9 + local user_symbol='$' 10 10 fi 11 11 12 12 if [ -z $SSH_CONNECTION ]; then 13 - local ssh_indicator="$terminfo[bold]$fg[green][LOCAL]$reset_color" 13 + local ssh_indicator="$terminfo[bold]$fg[green][LOCAL]$reset_color" 14 14 else 15 - local ssh_indicator="$terminfo[bold]$fg[red][ SSH]$reset_color" 15 + local ssh_indicator="$terminfo[bold]$fg[red][ SSH]$reset_color" 16 16 fi 17 17 18 18 local current_dir='%{$terminfo[bold]$fg[blue]%}%~ %{$reset_color%}' 19 19 20 - # hg_prompt_info requires this plugin: 21 - # https://github.com/iarkhanhelsky/oh-my-zsh-hg-prompt 22 - local vcs_branch='$(git_prompt_info)$(hg_prompt_info)' 20 + function jj_prompt_info() { 21 + if command -v jj &> /dev/null && jj root &> /dev/null 2>&1; then 22 + local jj_bookmark=$(jj log -r @ --no-graph -T 'bookmarks' 2>/dev/null | tr -d '\n') 23 + local jj_id=$(jj log -r @ --no-graph -T 'change_id.short()' 2>/dev/null | tr -d '\n') 24 + 25 + if [[ -n "$jj_bookmark" ]]; then 26 + echo "$jj_bookmark" 27 + else 28 + echo "$jj_id" 29 + fi 30 + fi 31 + } 32 + 33 + function custom_git_prompt_info() { 34 + if command -v git &> /dev/null && git rev-parse --git-dir &> /dev/null 2>&1; then 35 + local branch=$(git branch --show-current 2>/dev/null) 36 + local dirty=$(git status --porcelain 2>/dev/null | wc -l | tr -d ' ') 37 + 38 + if [[ $dirty -gt 0 ]]; then 39 + echo "${branch}*" 40 + else 41 + echo "$branch" 42 + fi 43 + fi 44 + } 45 + 46 + function custom_hg_prompt_info() { 47 + if command -v hg &> /dev/null && hg root &> /dev/null 2>&1; then 48 + local hg_info=$(hg id -i 2>/dev/null) 49 + 50 + if [[ $hg_info == *"+"* ]]; then 51 + echo "${hg_info%+}*" 52 + else 53 + echo "$hg_info" 54 + fi 55 + fi 56 + } 23 57 58 + function pijul_prompt_info() { 59 + if command -v pijul &> /dev/null && pijul channel &> /dev/null 2>&1; then 60 + local channel=$(pijul channel 2>/dev/null | grep '^\*' | sed 's/^\* //') 61 + local dirty=$(pijul diff --short 2>/dev/null | wc -c | tr -d ' ') 62 + 63 + if [[ $dirty -gt 0 ]]; then 64 + echo "${channel}*" 65 + else 66 + echo "$channel" 67 + fi 68 + fi 69 + } 70 + 71 + function vcs_prompt_info() { 72 + local vcs_info="" 73 + 74 + vcs_info=$(jj_prompt_info) 75 + if [[ -n "$vcs_info" ]]; then 76 + echo "%{$fg[yellow]%}‹${vcs_info}› %{$reset_color%}" 77 + return 78 + fi 79 + 80 + vcs_info=$(custom_git_prompt_info) 81 + if [[ -n "$vcs_info" ]]; then 82 + echo "%{$fg[yellow]%}‹${vcs_info}› %{$reset_color%}" 83 + return 84 + fi 85 + 86 + vcs_info=$(custom_hg_prompt_info) 87 + if [[ -n "$vcs_info" ]]; then 88 + echo "%{$fg[yellow]%}‹${vcs_info}› %{$reset_color%}" 89 + return 90 + fi 91 + 92 + vcs_info=$(pijul_prompt_info) 93 + if [[ -n "$vcs_info" ]]; then 94 + echo "%{$fg[yellow]%}‹${vcs_info}› %{$reset_color%}" 95 + return 96 + fi 97 + } 98 + 99 + local vcs_branch='$(vcs_prompt_info)' 24 100 local time_info='%{$fg[green]%}[%D{%H:%M}]%f' 25 101 26 102 ZSH_THEME_RVM_PROMPT_OPTIONS="i v g" ··· 29 105 %B${time_info}%b %B${user_symbol}%b " 30 106 RPROMPT="%B${return_code}%b" 31 107 32 - ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}‹" 33 - ZSH_THEME_GIT_PROMPT_SUFFIX="› %{$reset_color%}" 34 -