0
0

nvim_launch.zsh 601 B

1234567891011121314151617181920212223242526
  1. #!/bin/zsh
  2. if [ -n $1 ]; then
  3. cd $1
  4. fi;
  5. while true; do;
  6. if [ -f ./.venv/bin/activate ]; then
  7. source ./.venv/bin/activate
  8. elif [ -f ./venv/bin/activate ]; then
  9. source ./venv/bin/activate
  10. fi
  11. nvim -O $(
  12. (
  13. (git status --porcelain | sed s/^...//) &&
  14. (git log --numstat --format= HEAD~3..HEAD | cut -f3)
  15. ) |
  16. sort |
  17. uniq |
  18. xargs find 2>/dev/null |
  19. xargs -L1 -I_ date -r "_" +"%Y%m%d%H%M%S _" |
  20. sort -r |
  21. cut -c 16- |
  22. head -2
  23. ) || nvim;
  24. done;