aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2018-12-02 17:58:13 +1300
committerTom Ryder <tom@sanctum.geek.nz>2018-12-02 17:58:13 +1300
commit2d3f134c870f8a1a279f2ade4dfbef57b75f6ad9 (patch)
tree10f6c0d5a9614b52fd72205b2c05102f6bf0c182
parentUpgrade uncap_ex.vim plugin to v0.3.0 (diff)
downloaddotfiles-2d3f134c870f8a1a279f2ade4dfbef57b75f6ad9.tar.gz
dotfiles-2d3f134c870f8a1a279f2ade4dfbef57b75f6ad9.zip
Reduce ud() completion to just dirnames
This was really overdoing it.
-rw-r--r--bash/bash_completion.d/ud.bash37
1 files changed, 2 insertions, 35 deletions
diff --git a/bash/bash_completion.d/ud.bash b/bash/bash_completion.d/ud.bash
index a9912f5a..e6c79716 100644
--- a/bash/bash_completion.d/ud.bash
+++ b/bash/bash_completion.d/ud.bash
@@ -1,35 +1,2 @@
-# Completion setup for ud
-_ud() {
-
- # Only makes sense for the second argument
- ((COMP_CWORD == 2)) || return
-
- # Iterate through directories, null-separated, add them to completions
- local dirname
- while IFS= read -rd '' dirname ; do
- [[ -n "$dirname" ]] || continue
- COMPREPLY[${#COMPREPLY[@]}]=$dirname
- done < <(
-
- # Set options to glob correctly
- shopt -s dotglob nullglob
-
- # Make globbing case-insensitive if appropriate
- while read -r _ setting ; do
- case $setting in
- ('completion-ignore-case on')
- shopt -s nocaseglob
- break
- ;;
- esac
- done < <(bind -v)
-
- # Collect directory names, strip trailing slashes
- dirnames=("$2"*/)
- dirnames=("${dirnames[@]%/}")
-
- # Print results null-delimited
- printf '%s\0' "${dirnames[@]}"
- )
-}
-complete -F _ud -o filenames ud
+# Completie ud() with directory names
+complete -A directory ud