.agents/
.cargo/
.codex/
.config/
fish/
config.fish
3.7 KiB
pureish.fish
2.1 KiB
fontconfig/
foot/
fuzzel/
kanshi/
kitty/
mako/
nvim/
pulse/
rofi/
swm/
systemd/
uwsm/
waybar/
wireplumber/
.gnupg/
.local/
.vim/
bin/
etc/
images/
.dircolors
4.2 KiB
.fzy.zsh
1.1 KiB
.ghci
501 B
.gitconfig
2.2 KiB
.gitignore
0 B
.gitsigners
282 B
.ignore
136 B
.rgrc
174 B
.vimrc
12.7 KiB
.vimrc.lua
113 B
.wacom
260 B
.config/fish/pureish.fish
raw
| 1 | # Pure-inspired prompt, kept local to avoid a plugin dependency. |
| 2 | # Based on Pure fish's core ideas: pwd, git state, duration, SSH context, |
| 3 | # failure status, and a prompt symbol that turns red on error. |
| 4 | |
| 5 | function __pureish_git_prompt |
| 6 | command git rev-parse --is-inside-work-tree >/dev/null 2>&1; or return |
| 7 | |
| 8 | set -l branch (command git symbolic-ref --quiet --short HEAD 2>/dev/null) |
| 9 | if test -z "$branch" |
| 10 | set branch (command git rev-parse --short HEAD 2>/dev/null) |
| 11 | end |
| 12 | test -n "$branch"; or return |
| 13 | printf '%s' $branch |
| 14 | end |
| 15 | |
| 16 | function __pureish_duration |
| 17 | test "$CMD_DURATION" -ge 5000 2>/dev/null; or return |
| 18 | |
| 19 | if test "$CMD_DURATION" -lt 60000 |
| 20 | printf '%ss' (math --scale=1 "$CMD_DURATION / 1000") |
| 21 | else |
| 22 | set -l minutes (math --scale=0 "$CMD_DURATION / 60000") |
| 23 | set -l seconds (math --scale=0 "($CMD_DURATION % 60000) / 1000") |
| 24 | printf '%sm%ss' $minutes $seconds |
| 25 | end |
| 26 | end |
| 27 | |
| 28 | function fish_prompt |
| 29 | set -g __pureish_last_status $status |
| 30 | set -g __pureish_extra |
| 31 | set -l symbol '>' |
| 32 | set -l ssh |
| 33 | if test -n "$SSH_CLIENT"; or test -n "$SSH_TTY" |
| 34 | set ssh (whoami)'@'(hostname -s) |
| 35 | end |
| 36 | |
| 37 | set -l git (__pureish_git_prompt) |
| 38 | |
| 39 | if test -n "$ssh" |
| 40 | set_color brblack |
| 41 | printf '%s ' $ssh |
| 42 | end |
| 43 | |
| 44 | set_color 555555 |
| 45 | printf '%s' (prompt_pwd) |
| 46 | |
| 47 | if test -n "$git" |
| 48 | set_color brblack |
| 49 | printf ' %s' $git |
| 50 | end |
| 51 | |
| 52 | printf '\n' |
| 53 | |
| 54 | if test $__pureish_last_status -eq 0 |
| 55 | set_color blue |
| 56 | else |
| 57 | set_color red |
| 58 | end |
| 59 | |
| 60 | printf '%s ' $symbol |
| 61 | set_color normal |
| 62 | end |
| 63 | |
| 64 | function fish_right_prompt |
| 65 | set -l parts |
| 66 | set -l duration (__pureish_duration) |
| 67 | |
| 68 | if test -n "$duration" |
| 69 | set parts $parts $duration |
| 70 | end |
| 71 | |
| 72 | if test -n "$__pureish_extra" |
| 73 | set parts $parts $__pureish_extra |
| 74 | else if test "$__pureish_last_status" -ne 0 |
| 75 | set parts $parts "#$__pureish_last_status" |
| 76 | end |
| 77 | |
| 78 | test (count $parts) -gt 0; or return |
| 79 | set_color brblack |
| 80 | printf '%s' (string join ' ' $parts) |
| 81 | set_color normal |
| 82 | end |
| 83 | |
| 84 | function fish_title |
| 85 | set -l pwd (string replace -r "^$HOME(?=/|\$)" "~" -- "$PWD") |
| 86 | set -l process fish |
| 87 | if test (count $argv) -gt 0; and test -n "$argv[1]" |
| 88 | set process (string split -m1 ' ' -- "$argv[1]")[1] |
| 89 | end |
| 90 | printf '%s %s' "$pwd" "$process" |
| 91 | end |