aboutsummaryrefslogtreecommitdiff
path: root/bash/bashrc.d
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2016-06-15 10:28:02 +1200
committerTom Ryder <tom@sanctum.geek.nz>2016-06-15 10:28:02 +1200
commit5b8b515c57e682fe9a41e8436be3755e54f17253 (patch)
tree6d756b203c8b013e4884ad04f6be0f2f30dd811a /bash/bashrc.d
parentFilter to change s into zs (diff)
downloaddotfiles-5b8b515c57e682fe9a41e8436be3755e54f17253.tar.gz
dotfiles-5b8b515c57e682fe9a41e8436be3755e54f17253.zip
Correct td(1) completion
Forgot to narrow completions down to ones that match the current word
Diffstat (limited to 'bash/bashrc.d')
-rw-r--r--bash/bashrc.d/td.bash8
1 files changed, 4 insertions, 4 deletions
diff --git a/bash/bashrc.d/td.bash b/bash/bashrc.d/td.bash
index 825b5c54..d7200c87 100644
--- a/bash/bashrc.d/td.bash
+++ b/bash/bashrc.d/td.bash
@@ -7,10 +7,10 @@ _td() {
done < <(
shopt -s extglob nullglob
shopt -u dotglob
- declare -a fns
- cd -- "$dir" || exit
- fns=(*)
- ((${#fns[@]})) || exit
+ local -a fns
+ fns=("$dir"/"${COMP_WORDS[COMP_CWORD]}"*)
+ fns=("${fns[@]#$dir/}")
+ ((${#fns[@]})) || exit 1
printf '%s\0' "${fns[@]##$dir/}"
)
return