config.fish 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. set -U fish_greeting ""
  2. direnv hook fish | source
  3. function current_git_branch
  4. git symbolic-ref --quiet --short HEAD 2>/dev/null | read -l branch
  5. and printf '(%s)' $branch
  6. end
  7. function shlvl_prompt
  8. if test "$SHLVL" -gt 1
  9. printf '(%d)' "$SHLVL"
  10. end
  11. end
  12. function fish_prompt
  13. set -g fish_prompt_pwd_dir_length 0
  14. set_color normal
  15. shlvl_prompt
  16. set_color normal
  17. printf "("
  18. set_color --bold brblue
  19. printf "%s" $USER
  20. set_color normal
  21. printf "@"
  22. set_color --bold brblue
  23. printf "%s" (prompt_hostname)
  24. set_color normal
  25. printf ":"
  26. set_color --bold blue
  27. printf "%s" (prompt_pwd)
  28. set_color normal
  29. printf ")"
  30. set_color --bold brgreen
  31. current_git_branch
  32. set_color normal
  33. printf '$ '
  34. end
  35. function nix-update
  36. set -l orig_cwd (pwd)
  37. cd ~/nix-dots || return
  38. nix flake update
  39. or begin
  40. cd $orig_cwd
  41. return 1
  42. end
  43. nh os switch
  44. or begin
  45. cd $orig_cwd
  46. return 1
  47. end
  48. flatpak update -y
  49. cd $orig_cwd
  50. end
  51. function jclone
  52. git clone https://github.com/johron/$argv[1]
  53. end