1
0
Fork 0

wezterm: some more style; zsh: a bit of a refactor, a wip

This commit is contained in:
Von Random 2023-01-23 19:20:23 +02:00
parent 7a6c05c6da
commit 7f4db6c01f
2 changed files with 14 additions and 11 deletions

View file

@ -11,7 +11,7 @@ local overrides = {
}, },
theme = { color_scheme = 'PencilLight' } theme = { color_scheme = 'PencilLight' }
} }
local tab_bar_bg = '#97876f' local tab_bar_bg = '#ebdbae'
local tab_bar_fg = '#1e1e1e' local tab_bar_fg = '#1e1e1e'
local tab_bar_defaults = { local tab_bar_defaults = {
bg_color = tab_bar_bg, bg_color = tab_bar_bg,
@ -113,5 +113,6 @@ return {
colors = custom_colors, colors = custom_colors,
use_fancy_tab_bar = false, use_fancy_tab_bar = false,
hide_tab_bar_if_only_one_tab = true, hide_tab_bar_if_only_one_tab = true,
tab_max_width = 128 tab_max_width = 128,
tab_bar_at_bottom = true
} }

View file

@ -5,6 +5,7 @@ printf -v PROMPT4 $prompt_fmtn '+%N:%i'
prompt_wt="$USERNAME@$HOST" prompt_wt="$USERNAME@$HOST"
prompt_fifo=~/.zsh_gitstatus_$$ prompt_fifo=~/.zsh_gitstatus_$$
prompt_blimit=12
typeset -A prompt_symbols=( typeset -A prompt_symbols=(
sep_a $'\ue0b0' sep_a $'\ue0b0'
sep_b $'\ue0b1' sep_b $'\ue0b1'
@ -34,6 +35,12 @@ typeset -A prompt_colors=(
git_unmerged '#689d6a' git_unmerged '#689d6a'
) )
precmd.is_git_repo() {
typeset prompt_git_dir
prompt_git_dir=$(git rev-parse --git-dir 2>/dev/null) || return 1
[[ ! -e $prompt_git_dir/nozsh ]]
}
precmd.prompt.init() { precmd.prompt.init() {
typeset -g prompt_string= prev_color= typeset -g prompt_string= prev_color=
} }
@ -85,26 +92,21 @@ precmd.prompt.ro() {
[[ -w . ]] || precmd.prompt.add $prompt_symbols[ro] $prompt_colors[ro] [[ -w . ]] || precmd.prompt.add $prompt_symbols[ro] $prompt_colors[ro]
} }
precmd.is_git_repo() {
typeset prompt_git_dir
prompt_git_dir=$(git rev-parse --git-dir 2>/dev/null) || return 1
[[ ! -e $prompt_git_dir/nozsh ]]
}
precmd.prompt.pre_git() { precmd.prompt.pre_git() {
precmd.prompt.add "$prompt_symbols[git] $prompt_symbols[ellipsis]" $prompt_colors[git_branch] precmd.prompt.add "$prompt_symbols[git] $prompt_symbols[ellipsis]" $prompt_colors[git_branch]
} }
precmd.prompt.git() { precmd.prompt.git() {
typeset raw_status typeset raw_status IFS=
raw_status=$(git status --porcelain -bu 2>/dev/null) || return 0 raw_status=$(git status --porcelain -bu 2>/dev/null) || return 0
typeset -A count typeset -A count
typeset branch_status git_status_string IFS=
while read line; do while read line; do
case $line[1,2] in case $line[1,2] in
('##') ('##')
branch_status=${line[4,-1]%%...*} typeset branch_status=${line[4,-1]%%...*}
((${#branch_status}>prompt_blimit)) && \
branch_status=$branch_status[1,$prompt_blimit]$prompt_symbols[ellipsis]
[[ $line =~ behind ]] && branch_status+=? [[ $line =~ behind ]] && branch_status+=?
[[ $line =~ ahead ]] && branch_status+=! [[ $line =~ ahead ]] && branch_status+=!
precmd.prompt.add "$prompt_symbols[git] $branch_status" $prompt_colors[git_branch] precmd.prompt.add "$prompt_symbols[git] $branch_status" $prompt_colors[git_branch]