summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--functions/e.fish9
1 files changed, 9 insertions, 0 deletions
diff --git a/functions/e.fish b/functions/e.fish
new file mode 100644
index 0000000..8a14051
--- /dev/null
+++ b/functions/e.fish
@@ -0,0 +1,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