From 4cbbd121c012b3962f12fdff0f1820c3b8636a44 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sat, 30 Jul 2016 01:17:09 +1200 Subject: Move bash completion setup into separate dir --- bash/bashrc.d/bd.bash | 23 ----------------------- 1 file changed, 23 deletions(-) (limited to 'bash/bashrc.d/bd.bash') diff --git a/bash/bashrc.d/bd.bash b/bash/bashrc.d/bd.bash index b7fbe77e..23a2d380 100644 --- a/bash/bashrc.d/bd.bash +++ b/bash/bashrc.d/bd.bash @@ -76,26 +76,3 @@ bd() { # Try to change into the determined directory builtin cd "${opts[@]}" -- "$dirname" } - -# Completion setup for bd -_bd() { - - # Only makes sense for the first argument - ((COMP_CWORD == 1)) || return 1 - - # Build a list of dirnames in $PWD - local -a dirnames - IFS=/ read -d '' -a dirnames < <(printf '%s\0' "${PWD#/}") - - # Remove the last element in the array (the current directory) - ((${#dirnames[@]})) || return 1 - dirnames=("${dirnames[@]:0:"$((${#dirnames[@]}-1))"}") - - # Add the matching dirnames to the reply - local dirname - for dirname in "${dirnames[@]}" ; do - [[ $dirname == "${COMP_WORDS[COMP_CWORD]}"* ]] || continue - COMPREPLY=("${COMPREPLY[@]}" "$(printf %q "$dirname")") - done -} -complete -F _bd bd -- cgit v1.2.3