aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-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