You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

theme.elv 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. use re
  2. use git
  3. use util
  4. use timer
  5. edit:rprompt-persistent = $true
  6. edit:prompt-stale-threshold = 0.1
  7. edit:rprompt-stale-transform = { put ⏳ }
  8. edit:-prompt-eagerness = 5
  9. pwd-limit = 20
  10. max-dir-len = 1
  11. basesym = ▲
  12. if (or (has-env SSH_CLIENT) (has-env SSH_TTY)) {
  13. basesym = ◆
  14. }
  15. fn sym {
  16. if ?(isnimbleproject) {
  17. put 👑
  18. } else { put $basesym }
  19. }
  20. fn pwd {
  21. tmp = (tilde-abbr $pwd)
  22. if (or (< (count $tmp) $pwd-limit) (< $max-dir-len 1)) {
  23. put $tmp
  24. } else {
  25. re:replace '(\.?[^/]{'$max-dir-len'})[^/]*/' '$1/' $tmp
  26. }
  27. }
  28. fn git {
  29. git:refresh-status
  30. if (not-eq $git:branch '') {
  31. if (not-eq $git:untracked 0) {
  32. styled ' +'$git:untracked magenta
  33. }
  34. if (not-eq $git:dirty 0) {
  35. styled ' ✎'$git:dirty red
  36. }
  37. if (not-eq $git:staged 0) {
  38. styled ' ✓'$git:staged green
  39. }
  40. if (not-eq $git:ahead 0) {
  41. styled ' ⇡'$git:ahead blue
  42. }
  43. if (not-eq $git:behind 0) {
  44. styled ' ⇣'$git:behind blue
  45. }
  46. styled ' '$git:branch cyan
  47. }
  48. }
  49. edit:prompt = {
  50. put "\n "(sym)' '
  51. styled (pwd)' ' cyan
  52. }
  53. edit:rprompt = {
  54. if (not-eq $num-bg-jobs 0) {
  55. put ' '$num-bg-jobs
  56. }
  57. put $timer:composed
  58. git
  59. }