From 4ade92e9a4f8ded6a1dd1cd87b3fca9d495ac14b Mon Sep 17 00:00:00 2001 From: ache Date: Fri, 9 Aug 2024 04:26:38 +0200 Subject: Create edit command e --- functions/e.fish | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 functions/e.fish (limited to 'functions/e.fish') 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 -- cgit v1.2.3-70-g09d2