Skip to content

Commit

Permalink
Merge pull request #451 from nwinkler/dirs-completion
Browse files Browse the repository at this point in the history
Added completion for dirs plugin
  • Loading branch information
nwinkler committed Apr 16, 2015
2 parents 81c7618 + 409e552 commit 1cf7a9b
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions completion/available/dirs.completion.bash
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 1cf7a9b

Please sign in to comment.