diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2015-10-21 13:55:39 +1300 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2015-10-21 13:55:39 +1300 |
commit | e8931dff60564306a5a6370f97d7c543e5663f1e (patch) | |
tree | e798e3c1085e4e788df2d8119141f407a7feaf24 /bash/bashrc.d/ud.bash | |
parent | Switch compopt back out (diff) | |
download | dotfiles-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/ud.bash')
-rw-r--r-- | bash/bashrc.d/ud.bash | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/bash/bashrc.d/ud.bash b/bash/bashrc.d/ud.bash index 46dbdd71..b05539ab 100644 --- a/bash/bashrc.d/ud.bash +++ b/bash/bashrc.d/ud.bash @@ -58,7 +58,6 @@ _ud() { # Iterate through directories, null-separated, add them to completions local dirname while IFS= read -d '' -r dirname ; do - [[ $dirname == "${COMP_WORDS[COMP_CWORD]}"* ]] || continue COMPREPLY=("${COMPREPLY[@]}" "$dirname") done < <( @@ -67,7 +66,7 @@ _ud() { # Collect directory names, strip trailing slashes local -a dirnames - dirnames=(*/) + dirnames=("${COMP_WORDS[COMP_CWORD]}"*/) dirnames=("${dirnames[@]%/}") # Bail if no results to prevent empty output |