config.fish 851 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. set fish_greeting
  2. function posix_source
  3. for line in (cat $argv)
  4. set ass (echo $line | sed 's/export //')
  5. set arr (string split -m1 = $ass)
  6. set v (echo $arr[2] | sed -E 's/\$\((.*)\)/\1/')
  7. if [ $v != $arr[2] ]
  8. set -gx $arr[1] ($v)
  9. else if [ (echo $arr[1] | cut -c1) != '#' ]
  10. set -gx $arr[1] (eval "echo $arr[2]")
  11. end
  12. end
  13. end
  14. for name in (cat ~/.config/sh/functions | grep '()' | grep -v '#' | cut -d '(' -f 1)
  15. function $name
  16. bash -c ". ~/.config/sh/functions && $_ $argv"
  17. end
  18. end
  19. if [ (tty) = "/dev/tty1" ] && which sway >/dev/null 2>&1
  20. exec sway
  21. end
  22. . ~/.config/sh/aliases
  23. if [ -f ~/.config/sh/variables.(hostname) ]
  24. posix_source ~/.config/sh/variables.(hostname)
  25. end
  26. posix_source ~/.config/sh/variables
  27. if [ -f /tmp/ssh-agent.fish ]
  28. . /tmp/ssh-agent.fish >/dev/null
  29. end
  30. # todo function fish_prompt
  31. # echo ''
  32. # end