summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Pokorný <jpokorny@redhat.com>2014-02-14 16:56:45 +0100
committerJan Pokorný <jpokorny@redhat.com>2014-02-14 16:56:45 +0100
commit3020ea9939195b044b69382eab7c2a3ab6360b05 (patch)
tree4957ff73229e2de58d14db3b679b79139ef17f1c
parent7afda1f08683cc2bc8400d91cdce3a6ea8ba2ff3 (diff)
downloaddotfiles-3020ea9939195b044b69382eab7c2a3ab6360b05.tar.gz
dotfiles-3020ea9939195b044b69382eab7c2a3ab6360b05.tar.xz
dotfiles-3020ea9939195b044b69382eab7c2a3ab6360b05.zip
Bash config: enhance diralias bash completion
Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
-rw-r--r--.bashrc7
1 files changed, 6 insertions, 1 deletions
diff --git a/.bashrc b/.bashrc
index 322e3ee..1aae9d5 100644
--- a/.bashrc
+++ b/.bashrc
@@ -10,7 +10,12 @@ _diralias () {
}
diralias () {
alias "$(basename "$1")=_diralias $1"
- complete -C "f(){ find \"${1%%* }\" -maxdepth 1 -type d -name \"\$2*\" -printf '%f\\n'; }; f" "$(basename "$1")"
+ # using loose depth from the beginning unnecessarily clutter the offer,
+ # so this way, albeit complicated, convenient traversal is achieved
+ # XXX could -G be used instead?
+ complete -o nospace -C \
+ "f(){ find \"${1%%* }/\${2%\${2##*/}}\" -maxdepth 1 -type d -name \"\${2##*/}*\" \
+ -printf \"\${2%\${2##*/}}%P\\n\"; }; f" "$(basename "$1")"
}
_linkalias () {