summaryrefslogtreecommitdiff
path: root/functions/e.fish
diff options
context:
space:
mode:
authorache <ache@ache.one>2024-08-09 04:26:38 +0200
committerache <ache@ache.one>2024-08-09 04:26:38 +0200
commit4ade92e9a4f8ded6a1dd1cd87b3fca9d495ac14b (patch)
treedee5a20c35c0960dcfc49a24ce36090bd015b6b5 /functions/e.fish
parentImprove timestamp function (diff)
Create edit command e
Diffstat (limited to 'functions/e.fish')
-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