aboutsummaryrefslogtreecommitdiffhomepage
path: root/share
diff options
context:
space:
mode:
authorGravatar maxfl <gmaxfl@gmail.com>2012-06-26 04:01:35 +0400
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2012-06-26 19:17:32 -0700
commite995cc9329faf2d7cbd071c591fe21282e4ef7b8 (patch)
tree1fb03a0d88a7f04e198068e2bc064f901270798d /share
parent9457c115be622352cb1904c1e46e004e1f278d28 (diff)
fix #177 (complete 'cd' only with paths)
Diffstat (limited to 'share')
-rw-r--r--share/functions/__fish_complete_cd.fish12
1 files changed, 4 insertions, 8 deletions
diff --git a/share/functions/__fish_complete_cd.fish b/share/functions/__fish_complete_cd.fish
index 5e519835..73307e5e 100644
--- a/share/functions/__fish_complete_cd.fish
+++ b/share/functions/__fish_complete_cd.fish
@@ -1,11 +1,8 @@
function __fish_complete_cd -d "Completions for the cd command"
-
#
# We can't simply use __fish_complete_directories because of the CDPATH
#
-
set -l wd $PWD
- set -l owd $OLDPWD
# Check if CDPATH is set
@@ -17,10 +14,10 @@ function __fish_complete_cd -d "Completions for the cd command"
set mycdpath $CDPATH
end
-
- if echo '(commandline -ct)'|sgrep '^/\|^\./\|^\.\./' >/dev/null
+ set -l ctoken (commandline -ct)
+ if echo $ctoken | sgrep '^/\|^\./\|^\.\./\|^~/' >/dev/null
# This is an absolute search path
- eval printf '\%s\\tDirectory\\n' '(commandline -ct)'\*/
+ eval printf '\%s\\tDirectory\\n' $ctoken\*/
else
# This is a relative search path
# Iterate over every directory in CDPATH
@@ -33,11 +30,10 @@ function __fish_complete_cd -d "Completions for the cd command"
builtin cd $wd
eval builtin cd $i
- eval printf '"%s\tDirectory in "'$i'"\n"' '(commandline -ct)'\*/
+ eval printf '"%s\tDirectory in "'$i'"\n"' $ctoken\*/
end
end
builtin cd $wd
- set OLDPWD $owd
end