summaryrefslogtreecommitdiff
path: root/se
diff options
context:
space:
mode:
Diffstat (limited to 'se')
-rwxr-xr-xse16
1 files changed, 16 insertions, 0 deletions
diff --git a/se b/se
new file mode 100755
index 0000000..5450a5c
--- /dev/null
+++ b/se
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+: "${EDITOR:=${VISUAL:=vi}}"
+: "${SCRIPTS:=$HOME/.scripts}"
+
+file=$(
+ find "$SCRIPTS" -maxdepth 2 -type f -readable \
+ -not -path '*/.git/*' \
+ -or -not -name '\.*' 2>/dev/null |
+ sed 's|^\./||' |
+ sort --ignore-case --unique |
+ fzf --prompt="Open script > " \
+ --preview 'sed -n "1,200p" {}'
+)
+
+[ -n "$file" ] && "$EDITOR" "$file"