Merge pull request #451 from nwinkler/dirs-completion

Added completion for dirs plugin
pull/452/head
Nils Winkler 2015-04-16 10:44:19 +02:00
commit 1cf7a9b7ad
1 changed files with 15 additions and 0 deletions

View File

@ -0,0 +1,15 @@
#!/usr/bin/env bash
# Bash completion support for the 'dirs' plugin (commands G, R).
_dirs-complete() {
local CURRENT_PROMPT="${COMP_WORDS[COMP_CWORD]}"
# parse all defined shortcuts from ~/.dirs
if [ -r $HOME/.dirs ]; then
COMPREPLY=($(compgen -W "$(grep -v '^#' ~/.dirs | sed -e 's/\(.*\)=.*/\1/')" -- ${CURRENT_PROMPT}) )
fi
return 0
}
complete -o default -o nospace -F _dirs-complete G R