#!/bin/zsh if [ -n $1 ]; then cd $1 fi; while true; do; if [ -f ./.venv/bin/activate ]; then source ./.venv/bin/activate elif [ -f ./venv/bin/activate ]; then source ./venv/bin/activate fi nvim -O $( ( (git status --porcelain | sed s/^...//) && (git log --numstat --format= HEAD~3..HEAD | cut -f3) ) | sort | uniq | xargs find 2>/dev/null | xargs -L1 -I_ date -r "_" +"%Y%m%d%H%M%S _" | sort -r | cut -c 16- | head -2 ) || nvim; done;