aboutsummaryrefslogtreecommitdiff
path: root/vis-complete
diff options
context:
space:
mode:
authorRichard Burke <rich.g.burke@gmail.com>2016-10-11 22:25:25 +0100
committerRichard Burke <rich.g.burke@gmail.com>2016-10-11 22:33:17 +0100
commit68037c567f3c8d9bf5fda429a5542182d20891bf (patch)
tree7e09d1dbd567cf39f1662de47d630150ccec5009 /vis-complete
parentb0c9b0063d0b9ed9a7f93c69779749130b353ff1 (diff)
downloadvis-68037c567f3c8d9bf5fda429a5542182d20891bf.tar.gz
vis-68037c567f3c8d9bf5fda429a5542182d20891bf.tar.xz
File completion updates
Diffstat (limited to 'vis-complete')
-rwxr-xr-xvis-complete16
1 files changed, 11 insertions, 5 deletions
diff --git a/vis-complete b/vis-complete
index 43b080f..4a3ee57 100755
--- a/vis-complete
+++ b/vis-complete
@@ -28,21 +28,27 @@ while [ $# -gt 0 ]; do
esac
done
-if [ $COMPLETE_WORD = 1 ]; then
- tr -cs '[:alnum:]_' '\n' |
- grep "^$(basic_regex_quote "$PATTERN")." |
- sort -u
-else
+if [ $COMPLETE_WORD = 0 ]; then
case $PATTERN in
/*)
# An absolute path. This is fine.
;;
+ '~'|'~/'*)
+ # Expand tilde to $HOME
+ PATTERN=$HOME$(echo $PATTERN | tail -c +2)
+ ;;
*)
# A relaive path. Let's make it absolute.
PATTERN=$PWD/$PATTERN
;;
esac
+fi
+if [ $COMPLETE_WORD = 1 ]; then
+ tr -cs '[:alnum:]_' '\n' |
+ grep "^$(basic_regex_quote "$PATTERN")." |
+ sort -u
+else
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