diff options
Diffstat (limited to '.config')
| -rw-r--r-- | .config/fish/config.fish | 2 | ||||
| -rw-r--r-- | .config/fish/functions/fish_prompt.fish | 86 | ||||
| -rw-r--r-- | .config/starship.toml | 201 |
3 files changed, 86 insertions, 203 deletions
diff --git a/.config/fish/config.fish b/.config/fish/config.fish index 5cce240..9774f7f 100644 --- a/.config/fish/config.fish +++ b/.config/fish/config.fish @@ -1,9 +1,7 @@ if status is-interactive - starship init fish | source atuin init fish | sed '/^bind.*_atuin_bind_up/d' | source end -alias ls exa alias parallel parallel-moreutils alias cfg 'git --git-dir $HOME/.cfg --work-tree $HOME' diff --git a/.config/fish/functions/fish_prompt.fish b/.config/fish/functions/fish_prompt.fish new file mode 100644 index 0000000..494b07f --- /dev/null +++ b/.config/fish/functions/fish_prompt.fish @@ -0,0 +1,86 @@ +function fish_prompt + set -l cmd_status $status + set -l cmd_duration (math -s0 $CMD_DURATION / 1000) + set CMD_DURATION 0 + set -l is_git (git rev-parse --is-inside-work-tree 2>/dev/null) + + echo + + set_color --bold cyan + if [ "$is_git" = true ] + printf "%s" (git rev-parse --show-toplevel | awk -F/ '{ print $NF }') + set -l git_path (git rev-parse --show-prefix | sed 's#/$##') + [ -n "$git_path" ] && printf '/%s' $git_path + else + printf (prompt_pwd -d0) + end + set_color normal + + if [ "$is_git" = true ] + printf " on " + set_color --bold magenta + printf " "(git branch --show-current) + + function git_status + set -l s (git status --porcelain -b | string split0) + + git rev-parse --verify refs/stash &>/dev/null && printf '$' + echo $s | grep -q '^U[UDA]|^AA|^DD|^[DA]U' && printf "=" + echo $s | grep -q '^[MARCDU ]D|^D[ UM]' && printf "✘" + echo $s | grep -q '^R[ MD]' && printf "»" + echo $s | grep -q '^[ MARC]M' && printf "!" + echo $s | grep -q '^A[ MDAU]|^M[ MD]|^UA' && printf "+" + echo $s | grep -q '^\?\?' && printf "?" + + set -l ahead (echo $s | grep -q '^## [^ ]\+ .*ahead'; echo $status) + set -l behind (echo $s | grep -q '^## [^ ]\+ .*behind'; echo $status) + if [ "$ahead" -eq 0 ] && [ "$behind" -eq 0 ] + printf "⇕" + elif [ "$ahead" -eq 0 ] + printf "⇡" + elif [ "$behind" -eq 0 ] + printf "⇣" + end + end + + set -l stat (git_status) + if [ -n "$stat" ] + set_color --bold red + printf " [%s]" "$stat" + end + + set_color normal + end + + if [ "$cmd_duration" -gt 1 ] + printf " took" + set_color --bold yellow + + set -l secs (math -s1 $cmd_duration % 60) + set -l mins (math -s0 $cmd_duration / 60 % 60) + set -l hours (math -s0 $cmd_duration / 3600) + + [ "$hours" -gt 0 ] && printf " %dh" "$hours" + [ "$mins" -gt 0 ] && printf " %dm" "$mins" + [ "$secs" -gt 0 ] && printf " %ds" "$secs" + set_color normal + end + + echo + + if jobs &>/dev/null + set -l jobs (jobs | wc -l) + set_color --bold blue + printf "✦ " + [ "$jobs" -gt 1 ] && printf "%d " "$jobs" + set_color normal + end + + if [ "$cmd_status" -eq 0 ] + set_color green + else + set_color red + end + printf "❯ " + set_color normal +end diff --git a/.config/starship.toml b/.config/starship.toml deleted file mode 100644 index 51fba92..0000000 --- a/.config/starship.toml +++ /dev/null @@ -1,201 +0,0 @@ -palette = "catppuccin_macchiato" - -[palettes.catppuccin_macchiato] -rosewater = "#f4dbd6" -flamingo = "#f0c6c6" -pink = "#f5bde6" -mauve = "#c6a0f6" -red = "#ed8796" -maroon = "#ee99a0" -peach = "#f5a97f" -yellow = "#eed49f" -green = "#a6da95" -teal = "#8bd5ca" -sky = "#91d7e3" -sapphire = "#7dc4e4" -blue = "#8aadf4" -lavender = "#b7bdf8" -text = "#cad3f5" -subtext1 = "#b8c0e0" -subtext0 = "#a5adcb" -overlay2 = "#939ab7" -overlay1 = "#8087a2" -overlay0 = "#6e738d" -surface2 = "#5b6078" -surface1 = "#494d64" -surface0 = "#363a4f" -base = "#24273a" -mantle = "#1e2030" -crust = "#181926" - -[aws] -symbol = " " - -[azure] -symbol = " " - -[c] -symbol = " " - -[cmake] -symbol = " " - -[cobol] -symbol = " " - -[container] -symbol = " " - -[crystal] -symbol = " " - -[dart] -symbol = " " - -[directory] -read_only = " " - -[docker_context] -symbol = " " - -[dotnet] -symbol = " " - -[elixir] -symbol = " " - -[elm] -symbol = " " - -[erlang] -symbol = " " - -[gcloud] -symbol = " " - -[git_commit] -tag_symbol = " " - -[golang] -symbol = " " - -[guix_shell] -symbol = " " - -[gradle] -symbol = " " - -[haskell] -symbol = " " - -[haxe] -symbol = " " - -[helm] -symbol = " " - -[hostname] -ssh_symbol = " " - -[java] -symbol = " " - -[julia] -symbol = " " - -[kotlin] -symbol = " " - -[kubernetes] -symbol = " " - -[lua] -symbol = " " - -[nim] -symbol = " " - -[nix_shell] -symbol = " " - -[nodejs] -symbol = " " - -[ocaml] -symbol = " " - -[openstack] -symbol = " " - -[os.symbols] -Alpine = " " -Amazon = " " -Android = " " -Arch = " " -Artix = " " -CentOS = " " -Debian = " " -EndeavourOS = " " -Fedora = " " -FreeBSD = " " -Gentoo = " " -Illumos = " " -Linux = " " -Macos = " " -Manjaro = " " -Mint = " " -NixOS = " " -OpenBSD = " " -openSUSE = " " -Pop = " " -Raspbian = " " -Redhat = " " -RedHatEnterprise = " " -Solus = " " -SUSE = " " -Ubuntu = " " -Windows = " " - -[package] -style = "bold peach" -symbol = " " - -[perl] -symbol = " " - -[php] -symbol = " " - -[purescript] -symbol = " " - -[python] -symbol = " " -style = "green bold" - -[rlang] -symbol = " " - -[ruby] -symbol = " " - -[rust] -symbol = " " - -[scala] -symbol = " " - -[shlvl] -symbol = " " - -[swift] -symbol = " " - -[terraform] -symbol = " " - -[vlang] -symbol = " " - -[zig] -symbol = " " |
