summaryrefslogtreecommitdiff
path: root/se
blob: 5450a5ccb253075f7593047c6cdd287acc58f6a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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"