diff options
| author | TwoFinger <Two-Finger@users.noreply.github.com> | 2018-01-25 20:27:29 +0200 |
|---|---|---|
| committer | TwoFinger <Two-Finger@users.noreply.github.com> | 2018-01-27 13:06:53 +0200 |
| commit | 4709c829619dcbb568c16daf221295fe0a45db8c (patch) | |
| tree | 0a0f49f7462d5d21c6cfe757bda33bee7c2fac41 | |
| parent | e9c915335b162f05ad5246c166faa055a240118e (diff) | |
| download | vis-4709c829619dcbb568c16daf221295fe0a45db8c.tar.gz vis-4709c829619dcbb568c16daf221295fe0a45db8c.tar.xz | |
vis-complete: Show just basenames in vis-menu
| -rwxr-xr-x | vis-complete | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/vis-complete b/vis-complete index 255958d..2df916c 100755 --- a/vis-complete +++ b/vis-complete @@ -36,28 +36,30 @@ else # Expand to absolute path because of the -path option below. case $PATTERN in /*) + XPATTERN=$PATTERN ;; '~'|'~/'*) - PATTERN=$HOME$(echo $PATTERN | tail -c +2) + XPATTERN=$HOME$(echo $PATTERN | tail -c +2) ;; *) - PATTERN=$PWD/$PATTERN + XPATTERN=$PWD/$PATTERN ;; esac # The first path condition rules out paths that start with "." unless # they start with "..". That way, hidden paths should stay hidden, but # non-normalised paths should still show up. - find $(dirname "$PATTERN") \ + find $(dirname "$XPATTERN") \ -name '.*' -prune \ -o \( \ ! -name '.*' \ - -a -path "$(glob_quote "$PATTERN")*" \ + -a -path "$(glob_quote "$XPATTERN")*" \ -print \ \) 2>/dev/null | head -n $FIND_FILE_LIMIT | - sort + sort | + xargs -n1 basename fi | vis-menu -b | - sed "s/^$(printf "%s" "$PATTERN" | sed 's:/:\\/:g' )//" | + sed "s/^$(basename $PATTERN)//" | tr -d '\n' |
