diff options
author | Fabian Homborg <FHomborg@gmail.com> | 2016-04-08 15:03:49 +0200 |
---|---|---|
committer | Fabian Homborg <FHomborg@gmail.com> | 2016-04-08 15:03:49 +0200 |
commit | d7c690b4162ddd25c4ef6177a9e88db283caf9fa (patch) | |
tree | 3a9e59c5b87c06252455b5d3867682425879dafb | |
parent | 8eb9dac4bc83fe02b3833e51de3d1d430a6a61c8 (diff) |
Fix "." and ".." paths in cd completions
Previously if a directory called "a" was in $CDPATH, `cd ./a<TAB>` would
complete from there even if it was invalid.
-rw-r--r-- | share/functions/__fish_complete_cd.fish | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/share/functions/__fish_complete_cd.fish b/share/functions/__fish_complete_cd.fish index cdbd02a7..3ba2ad9d 100644 --- a/share/functions/__fish_complete_cd.fish +++ b/share/functions/__fish_complete_cd.fish @@ -1,7 +1,7 @@ function __fish_complete_cd -d "Completions for the cd command" set -l token (commandline -ct) - # Absolute path - no descriptions and no CDPATH - if string match -q '/*' -- $token + # Absolute path or explicitly from the current directory - no descriptions and no CDPATH + if string match -qr '^\.?\.?/.*' -- $token for d in $token*/ # Check if it's accessible - the glob only matches directories [ -x $d ]; and printf "%s\n" $d |