diff options
author | ridiculousfish <corydoras@ridiculousfish.com> | 2012-08-15 18:20:44 -0700 |
---|---|---|
committer | ridiculousfish <corydoras@ridiculousfish.com> | 2012-08-15 18:20:44 -0700 |
commit | 7d029778e627217bf7d3ef33b5fccf43f8dd4dde (patch) | |
tree | 8790a200ffa3e7c30af40e1ea500b2abe68c3e3a /share/functions/__fish_complete_cd.fish | |
parent | 26857fabdc72c4b045bf7acf6d2a6a4f55354bae (diff) |
Disable file completion descriptions per https://github.com/fish-shell/fish-shell/issues/279
Diffstat (limited to 'share/functions/__fish_complete_cd.fish')
-rw-r--r-- | share/functions/__fish_complete_cd.fish | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/share/functions/__fish_complete_cd.fish b/share/functions/__fish_complete_cd.fish index 73307e5e..cb10b7cf 100644 --- a/share/functions/__fish_complete_cd.fish +++ b/share/functions/__fish_complete_cd.fish @@ -1,4 +1,9 @@ function __fish_complete_cd -d "Completions for the cd command" + false +end + + +function __fish_complete_cd -d "Completions for the cd command" # # We can't simply use __fish_complete_directories because of the CDPATH # @@ -13,11 +18,15 @@ function __fish_complete_cd -d "Completions for the cd command" else set mycdpath $CDPATH end + + # Note how this works: we evaluate $ctoken*/ + # That trailing slash ensures that we only expand directories set -l ctoken (commandline -ct) if echo $ctoken | sgrep '^/\|^\./\|^\.\./\|^~/' >/dev/null # This is an absolute search path - eval printf '\%s\\tDirectory\\n' $ctoken\*/ + # Squelch descriptions per issue 254 + eval printf '\%s\\n' $ctoken\*/ else # This is a relative search path # Iterate over every directory in CDPATH @@ -30,7 +39,14 @@ function __fish_complete_cd -d "Completions for the cd command" builtin cd $wd eval builtin cd $i - eval printf '"%s\tDirectory in "'$i'"\n"' $ctoken\*/ + # What we would really like to do is skip descriptions if all + # valid paths are in the same directory, but we don't know how to + # do that yet; so instead skip descriptions if CDPATH is just . + if test "$mycdpath" = . + eval printf '"%s\n"' $ctoken\*/ + else + eval printf '"%s\tin "'$i'"\n"' $ctoken\*/ + end end end |