summaryrefslogtreecommitdiff
path: root/fzo
blob: 576125e8d20bdaad37cbd3864e9495da80449b71 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/bin/sh

: "${EDITOR:=${VISUAL:=vi}}"

file=$(
  find . -maxdepth 5 -type f -readable \
    -not -path '*/.git/*' 2>/dev/null |
    sed 's|^\./||' |
    sort --ignore-case --unique |
    fzf --prompt="Open file > " \
        --preview 'sed -n "1,200p" {}'
)

[ -n "$file" ] && "$EDITOR" "$file"