function e --wraps "$EDITOR" --description "Edit the file and set the working dir to the best usefull location" set -l gitRoot (git rev-parse --show-toplevel) if test -n "$gitRoot" cd $gitRoot else cd (dirname "$argv[1]") end $EDITOR "argv[1]" end