diff options
| author | Aryadev Chavali <aryadev@aryadevchavali.com> | 2025-11-04 00:26:24 +0000 |
|---|---|---|
| committer | Aryadev Chavali <aryadev@aryadevchavali.com> | 2025-11-04 16:35:13 +0000 |
| commit | 0f667e4d76857f582048a6560320c5515749242d (patch) | |
| tree | 6217ec6128b917ed530626e3063ee9ace12650bb /Scripts/.local/scripts | |
| parent | 1241cc216dee067356961bf12cb28a48206e169f (diff) | |
| download | dotfiles-0f667e4d76857f582048a6560320c5515749242d.tar.gz dotfiles-0f667e4d76857f582048a6560320c5515749242d.tar.bz2 dotfiles-0f667e4d76857f582048a6560320c5515749242d.zip | |
qedit: quickly write up some code in your editor of choice
Generates a temp file (with your choice of extension) which you can
then write code in immediately.
Diffstat (limited to 'Scripts/.local/scripts')
| -rwxr-xr-x | Scripts/.local/scripts/qedit | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/Scripts/.local/scripts/qedit b/Scripts/.local/scripts/qedit new file mode 100755 index 0000000..44cfa18 --- /dev/null +++ b/Scripts/.local/scripts/qedit @@ -0,0 +1,25 @@ +#!/usr/bin/env sh + +if [ $# -eq 0 ] || [ $# -gt 2 ] +then + printf "Usage: $0 <extension> [editor]\n" + exit 1 +fi + +name=$(mktemp --suffix=".$1") +editor="" + +if [ $# -eq 1 ] +then + if [ -z "$EDITOR" ] + then + editor="vim"; + else + editor="$EDITOR"; + fi +elif [ $# -eq 2 ] +then + editor="$2" +fi + +$editor $name |
