]> git.mdlowis.com Git - projs/tide.git/commitdiff
Added edit function to the editrc shell script example
authorMichael D. Lowis <mike.lowis@gentex.com>
Thu, 15 Jun 2017 17:22:40 +0000 (13:22 -0400)
committerMichael D. Lowis <mike.lowis@gentex.com>
Thu, 15 Jun 2017 17:22:40 +0000 (13:22 -0400)
editrc

diff --git a/editrc b/editrc
index 3c5fbff9541b4876bba680154c07451964ee18ac..2ed05583ef33281e87dc9cbd3ec354fcc8988ce5 100644 (file)
--- a/editrc
+++ b/editrc
@@ -1,5 +1,21 @@
 #!/bin/bash
 
+edit(){
+    # setup editor env
+    export PATH="$HOME/.config/edit/tools:$PATH"
+    export EDITRCFILE="$HOME/.config/edit/editrc"
+    export BASH_ENV="$EDITRCFILE"
+    [[ -f "$EDITRCFILE" ]] && . "$EDITRCFILE"
+
+    # Now figure out the correct editor to execute
+    if [[ -z "$DISPLAY" ]]; then
+        "$EDITOR" "$@"
+    else
+        # Launch in the background and disown
+        { tide "$@" & disown; } &> /dev/null
+    fi
+}
+
 # Tag Lines
 #------------------------------------------------------------------------------