vis
a vi-like editor based on Plan 9's structural regular expressions
git clone https://9o.is/git/vis.git
commit 4405f21a18f359c69699aecc232d6a2483b6837b parent f0368b130a05e8758a36912c0d652a2a6ae49a43 Author: Tim Allen <screwtape@froup.com> Date: Sat, 8 Oct 2016 23:06:00 +1100 Teach vis-complete that ".." path segments in the prefix are acceptable. Instead of trying to filter out path-segments-beginning-with-dot from the entire path (including the prefix, which would be perfectly legitimate), tell find to prune hidden directories and ignore hidden file as it walks the tree. Diffstat:
| M | vis-complete | | | 11 | +++++++++-- |
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/vis-complete b/vis-complete @@ -44,9 +44,16 @@ else esac START=$(dirname "$PATTERN") + # 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 "$START" \ - ! -path '*/\.*' \ - -a -path "$(glob_quote "$PATTERN")*" 2>/dev/null | + -name '.*' -prune \ + -o \( \ + ! -name '.*' \ + -a -path "$(glob_quote "$PATTERN")*" \ + -print \ + \) 2>/dev/null | head -n $FIND_FILE_LIMIT | sort fi |