1
0

config.elv 995 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. use prompt
  2. use nix-shell
  3. use direlv
  4. # import local.elv if present, for example, from ~/.config/elvish/lib/local.elv
  5. try {
  6. use local
  7. } catch e {
  8. }
  9. edit:add-var ls~ { |@a|
  10. e:ls --color=auto --group-directories-first -F --quoting-style literal $@a
  11. }
  12. if (has-external yadm) {
  13. set-env YADM_OVERRIDE_REPO ~/.dotfiles
  14. } else {
  15. edit:add-var yadm~ { |@a| git --git-dir=~/.dotfiles/ --work-tree=~ $@a }
  16. }
  17. if (has-external difft) {
  18. set-env GIT_EXTERNAL_DIFF difft
  19. }
  20. if (has-external delta) {
  21. set-env GIT_PAGER delta
  22. }
  23. # some additional bindings
  24. use readline-binding
  25. set edit:completion:binding[Ctrl-W] = $edit:close-mode~
  26. set edit:completion:binding[Tab] = $edit:completion:accept~
  27. var max-len = 30
  28. # print time if command takes longer than 5 seconds
  29. set edit:after-command = [{|m|
  30. if (> $m[duration] 5) {
  31. var cmd = $m[src][code]
  32. var len = (count $cmd)
  33. if (> $len $max-len) {
  34. set cmd = $cmd[..$max-len]…
  35. }
  36. printf "%s took %.3fs\n" $cmd $m[duration]
  37. }
  38. }]