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

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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 = [x]{ put ⏳$x }
  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. o = (e = ?(getprojecticon))
  17. if $e { put $o } else { put $basesym }
  18. }
  19. fn pwd {
  20. tmp = (tilde-abbr $pwd)
  21. if (or (< (count $tmp) $pwd-limit) (< $max-dir-len 1)) {
  22. put $tmp
  23. } else {
  24. re:replace '(\.?[^/]{'$max-dir-len'})[^/]*/' '$1/' $tmp
  25. }
  26. }
  27. fn git {
  28. git:refresh-status
  29. if (not-eq $git:branch '') {
  30. if (not-eq $git:untracked 0) {
  31. styled ' +'$git:untracked magenta
  32. }
  33. if (not-eq $git:dirty 0) {
  34. styled ' ✎'$git:dirty red
  35. }
  36. if (not-eq $git:staged 0) {
  37. styled ' ✓'$git:staged green
  38. }
  39. if (not-eq $git:ahead 0) {
  40. styled ' ⇡'$git:ahead blue
  41. }
  42. if (not-eq $git:behind 0) {
  43. styled ' ⇣'$git:behind blue
  44. }
  45. styled ' '$git:branch cyan
  46. }
  47. }
  48. edit:prompt = {
  49. put "\n "(sym)' '
  50. styled (pwd)' ' cyan
  51. }
  52. edit:rprompt = {
  53. if (not-eq $num-bg-jobs 0) {
  54. put ' '$num-bg-jobs
  55. }
  56. timer:display
  57. git
  58. }