aboutsummaryrefslogtreecommitdiff
path: root/bash/bashrc.d/path.bash
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2015-10-21 13:55:39 +1300
committerTom Ryder <tom@sanctum.geek.nz>2015-10-21 13:55:39 +1300
commite8931dff60564306a5a6370f97d7c543e5663f1e (patch)
treee798e3c1085e4e788df2d8119141f407a7feaf24 /bash/bashrc.d/path.bash
parentSwitch compopt back out (diff)
downloaddotfiles-e8931dff60564306a5a6370f97d7c543e5663f1e.tar.gz
dotfiles-e8931dff60564306a5a6370f97d7c543e5663f1e.zip
When expanding with globbing, use prefix
Rather than generating all possible completions and then filtering them down, use the completing word as a prefix for the glob
Diffstat (limited to 'bash/bashrc.d/path.bash')
-rw-r--r--bash/bashrc.d/path.bash4
1 files changed, 1 insertions, 3 deletions
diff --git a/bash/bashrc.d/path.bash b/bash/bashrc.d/path.bash
index bd290fb3..fb91558b 100644
--- a/bash/bashrc.d/path.bash
+++ b/bash/bashrc.d/path.bash
@@ -199,8 +199,6 @@ _path() {
insert|i|append|add|a|check|c|set|s)
local dirname
while IFS= read -d '' -r dirname ; do
- [[ $dirname == "${COMP_WORDS[COMP_CWORD]}"/* ]] \
- || continue
COMPREPLY=("${COMPREPLY[@]}" "$dirname")
done < <(
@@ -209,7 +207,7 @@ _path() {
# Collect directory names, strip trailing slash
local -a dirnames
- dirnames=(*/)
+ dirnames=("${COMP_WORDS[COMP_CWORD]}"*/)
dirnames=("${dirnames[@]%/}")
# Bail if no results to prevent empty output