diff options
| author | czjstmax <jstmaxlol@disroot.org> | 2026-05-16 17:55:27 +0200 |
|---|---|---|
| committer | czjstmax <jstmaxlol@disroot.org> | 2026-05-16 17:55:27 +0200 |
| commit | 092913992741384894caa98a37cf61e1096999d7 (patch) | |
| tree | 781faa4abd9c870d7c339d8137d0c38792beb5c9 /cfg/fish | |
| parent | fc54ce1f280cae9027f52cfe025cebdf62f3d4cf (diff) | |
update fish prompt + git integration, remove right prompt
Diffstat (limited to 'cfg/fish')
| -rw-r--r-- | cfg/fish/fish_prompt.fish | 30 | ||||
| -rw-r--r-- | cfg/fish/fish_right_prompt.fish | 20 |
2 files changed, 25 insertions, 25 deletions
diff --git a/cfg/fish/fish_prompt.fish b/cfg/fish/fish_prompt.fish index b14256f..e5c6af9 100644 --- a/cfg/fish/fish_prompt.fish +++ b/cfg/fish/fish_prompt.fish @@ -2,10 +2,18 @@ function fish_prompt set -l user $USER set -l cwd $PWD set -l home $HOME + set -l branch "" + set -l branch_sym "" # unused but here for da futurr + if test "$(git rev-parse --is-inside-work-tree 2>/dev/null)" = "true" + #set branch (git branch --show-current 2>/dev/null) + set branch (git branch --show-current 2>/dev/null); or set branch (git rev-parse --short HEAD 2>/dev/null) + end + if test "$cwd" = "$home" + set colored "~" # if in ~ - echo -e (set_color white)"("(set_color red)"$user"(set_color white)" at "(set_color red)"~"(set_color white)")\n" \ + echo -e (set_color white)"("(set_color red)"$user"(set_color white)" at "(set_color red)"$colored"(set_color white)")\n"\ (set_color white)"λ "(set_color normal) # max at ~ # λ @@ -23,8 +31,14 @@ function fish_prompt set colored (string trim -r -c "/" $colored) # if in a ~ subdir - echo -e (set_color white)"("(set_color red)"$user"(set_color white)" at "(set_color red)"$colored"(set_color white)")\n" \ - (set_color white)"λ "(set_color normal) + if test "$(git rev-parse --is-inside-work-tree 2>/dev/null)" = "true" + echo -e (set_color white)"("(set_color red)"$user"(set_color white)" at "(set_color red)"$colored"\ + (set_color white)"on "(set_color red)"$branch"(set_color white)")\n" \ + (set_color white)"λ "(set_color normal) + else + echo -e (set_color white)"("(set_color red)"$user"(set_color white)" at "(set_color red)"$colored"(set_color white)")\n"\ + (set_color white)"λ "(set_color normal) + end else set -l parts (string split "/" $cwd) set -l colored "" @@ -38,7 +52,13 @@ function fish_prompt set colored (string trim -r -c "/" $colored) set colored (set_color red)"#"$colored # if in any other dir - echo -e (set_color white)"("(set_color red)"$user"(set_color white)" at "(set_color red)"$colored"(set_color white)")\n" \ - (set_color white)"λ "(set_color normal) + if test "$(git rev-parse --is-inside-work-tree 2>/dev/null)" = "true" + echo -e (set_color white)"("(set_color red)"$user"(set_color white)" at "(set_color red)"$colored"\ + (set_color white)"on "(set_color red)"$branch"(set_color white)")\n" \ + (set_color white)"λ "(set_color normal) + else + echo -e (set_color white)"("(set_color red)"$user"(set_color white)" at "(set_color red)"$colored"(set_color white)")\n"\ + (set_color white)"λ "(set_color normal) + end end end diff --git a/cfg/fish/fish_right_prompt.fish b/cfg/fish/fish_right_prompt.fish deleted file mode 100644 index 8346fb5..0000000 --- a/cfg/fish/fish_right_prompt.fish +++ /dev/null @@ -1,20 +0,0 @@ -function fish_right_prompt - set last_status $status - - # check for which color to use - if test $last_status -eq 0 - set color white - else - set color red - end - - # set battery capacity in bat - set bat $(cat /sys/class/power_supply/BAT0/capacity) - - # move up a line - echo -e "\e[1A" - # print prompt - echo -e (set_color red)"( "(set_color $color)"$last_status"(set_color red)" |" \ - (set_color white)"$bat%"(set_color red)" )"(set_color normal) - echo -e "\e[1B" -end |