aboutsummaryrefslogtreecommitdiffhomepage
path: root/share/completions/pushd.fish
diff options
context:
space:
mode:
authorGravatar Fabian Homborg <FHomborg@gmail.com>2015-10-09 20:02:28 +0200
committerGravatar Fabian Homborg <FHomborg@gmail.com>2015-10-09 20:02:28 +0200
commit98b33d7b6b166b0ead2d7006df26a5789300dacc (patch)
treea966c85b8169e4bab2d81e494691bda70f972b6e /share/completions/pushd.fish
parent86471ac21f09273403708aa60dccd79944b37a52 (diff)
Fix pushd completions in the -n case
Diffstat (limited to 'share/completions/pushd.fish')
-rw-r--r--share/completions/pushd.fish3
1 files changed, 2 insertions, 1 deletions
diff --git a/share/completions/pushd.fish b/share/completions/pushd.fish
index 5d9519fc..d38dc298 100644
--- a/share/completions/pushd.fish
+++ b/share/completions/pushd.fish
@@ -10,8 +10,9 @@ end
function __fish_complete_pushd_minus
if count $dirstack > /dev/null
# print each member of the stack, replace $HOME with ~
+ # Negative arguments are expected to start at "-0"
for i in (seq (count $dirstack) -1 1)
- printf "-%s\t%s\n" $i "Rotate to "(string replace -r "^$HOME" "~" -- $dirstack[$i])
+ printf "%s\t%s\n" -(math $i - 1) "Rotate to "(string replace -r "^$HOME" "~" -- $dirstack[(math -$i)])
end
end
end