summaryrefslogtreecommitdiff
path: root/functions/e.fish
blob: 8a14051443c8ffbba56710f7a208fda3f8b3c45e (plain)
1
2
3
4
5
6
7
8
9
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