diff options
author | Von Random <von@mechanus.net> | 2023-06-26 23:20:05 +0300 |
---|---|---|
committer | Von Random <von@mechanus.net> | 2023-06-26 23:20:05 +0300 |
commit | 4532f14839f594696a68f394b9dbe55c6f35c850 (patch) | |
tree | 4f7b9cfaa238e27cebde877f4a2bfa279e48b9eb | |
parent | abb91ceb9639480336df4ef06438af7467463a0b (diff) |
improve things
-rw-r--r-- | cli/.config/fish/conf.d/prompt.fish | 16 | ||||
-rw-r--r-- | cli/.config/fish/functions/prompt.add.fish | 2 | ||||
-rw-r--r-- | cli/.config/fish/functions/prompt.git.fish | 12 | ||||
-rw-r--r-- | cli/.config/fish/functions/prompt.user.fish | 2 |
4 files changed, 17 insertions, 15 deletions
diff --git a/cli/.config/fish/conf.d/prompt.fish b/cli/.config/fish/conf.d/prompt.fish index 742f9b1..3d236a9 100644 --- a/cli/.config/fish/conf.d/prompt.fish +++ b/cli/.config/fish/conf.d/prompt.fish @@ -1,12 +1,14 @@ if ! string match -eq linux $TERM -# set prompt_sep \ue0b0 - set prompt_bang \n(set_color brred)\>\ - set git_sign \ue0a0 + set prompt_bang \n(set_color brred)\U266a\ + set git_sep \ue0a0 else - set prompt_bang \n(set_color brred)\#\ - set git_sign g + set prompt_bang \n(set_color brred)\>\ + set git_sep \| end -set color_fg brwhite +set color_user green set color_git_branch brwhite -set color_git yellow blue red purple + +# git file status: unstaged staged untracked conflicts +set color_git yellow green red purple +set state_git \~ + ! \* diff --git a/cli/.config/fish/functions/prompt.add.fish b/cli/.config/fish/functions/prompt.add.fish index 13b324d..75b58bb 100644 --- a/cli/.config/fish/functions/prompt.add.fish +++ b/cli/.config/fish/functions/prompt.add.fish @@ -2,7 +2,7 @@ function prompt.add set -l color $argv[1] set -l text $argv[2] set -l sep '' - set -a prompt_string (set_color $color)$text + set -a prompt_string (set_color $color)$text(set_color normal) # if test -n "$prompt_sep" # set sep (set_color $prev_color)$prompt_sep(set_color $color_fg) # set prev_color $color diff --git a/cli/.config/fish/functions/prompt.git.fish b/cli/.config/fish/functions/prompt.git.fish index 1c4e5a3..ff5af77 100644 --- a/cli/.config/fish/functions/prompt.git.fish +++ b/cli/.config/fish/functions/prompt.git.fish @@ -1,13 +1,13 @@ function prompt.git set -l is_git_tree (git rev-parse --is-inside-work-tree 2>/dev/null) string match -qe 'true' "$is_git_tree" || return - prompt.add white \]\[ + prompt.add white "$git_sep" git status --porcelain -bu | while read line if string match -qr '^##' "$line" set git_branch (string match -r '[^# .]+' "$line") string match -qr '\[behind' $line && set git_branch "$git_branch?" string match -qr '\[ahead' $line && set git_branch "$git_branch!" - prompt.add "$color_git_branch" "$git_sign $git_branch" + prompt.add "$color_git_branch" "$git_branch" else string match -qr "^.[MD]" "$line" && set git_count[1] (math $git_count[1] + 1) string match -qr "^[MDARC]." "$line" && set git_count[2] (math $git_count[2] + 1) @@ -15,8 +15,8 @@ function prompt.git string match -qr "^[ADU]{2}" "$line" && set git_count[4] (math $git_count[4] + 1) end end - test -n "$git_count[1]" && prompt.add "$color_git[1]" "~$git_count[1]" - test -n "$git_count[2]" && prompt.add "$color_git[2]" "+$git_count[2]" - test -n "$git_count[3]" && prompt.add "$color_git[3]" "!$git_count[3]" - test -n "$git_count[4]" && prompt.add "$color_git[4]" "*$git_count[4]" + test -n "$git_count[1]" && prompt.add "$color_git[1]" "$state_git[1]$git_count[1]" + test -n "$git_count[2]" && prompt.add "$color_git[2]" "$state_git[2]$git_count[2]" + test -n "$git_count[3]" && prompt.add "$color_git[3]" "$state_git[3]$git_count[3]" + test -n "$git_count[4]" && prompt.add "$color_git[4]" "$state_git[4]$git_count[4]" end diff --git a/cli/.config/fish/functions/prompt.user.fish b/cli/.config/fish/functions/prompt.user.fish index b2c87e7..cd0ae8f 100644 --- a/cli/.config/fish/functions/prompt.user.fish +++ b/cli/.config/fish/functions/prompt.user.fish @@ -1,5 +1,5 @@ function prompt.user if test -n "$SSH_CONNECTION" || string match -qe root "$USER" - prompt.add white $USER@$hostname + prompt.add $color_user $USER@$hostname end end |