From 99d822785dd8431e3f3dcbfcbdbe2820a08540bb Mon Sep 17 00:00:00 2001 From: "Michael D. Lowis" Date: Thu, 15 Jun 2017 13:22:40 -0400 Subject: [PATCH] Added edit function to the editrc shell script example --- editrc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/editrc b/editrc index 3c5fbff..2ed0558 100644 --- 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 #------------------------------------------------------------------------------ -- 2.49.0