Resolves issue where z mydir/ fails even when mydir exists
Shell built-in directory tests can fail when paths have trailing slashes. This fix strips trailing slashes before the directory test while preserving the original path for cd.
Changes: Fish, Bash, Zsh, POSIX, and Tcsh templates now strip trailing slashes before directory tests
Fish ships with built-in completions for common commands like `j` (share/completions/j.fish for autojump). These override zoxide's completions when using `--cmd j`. Clear them before defining aliases.
Only ksh93 supports DEBUG traps, and the rest don't have any features
that can be used for setting up hooks. May as well use the POSIX
implementation for all ksh shells.
* support autocd option
In bash, when autocd option is set and user enters a directory name as a
command, it results in a very specific call to cd:
cd -- [directory name]
zoxide's directory changing function passes all arguments to __zoxide_z as is,
including the "--" first argument. By detecting this and skipping the first
argument changing directory works with autocd set.
* remove directory check
just skip the first argument and pass the rest as is. checking for directory
breaks cd'ing to symlinked directories
* undo some of the hackery
tests are failing
elvish uses lexical scoping for closure capture, as such all `oldpwd`
references within the script refers to the `oldpwd` defined at the top.
However, before-chdir hook is trying to assign to `oldpwd` within the
editor scope, which is not used by this script.
This manifested as a bug in which:
```
~
> mkdir -p /tmp/another
~
> z /tmp
/tmp
> z another
/tmp/another
> z -
~
> # The previous dir should be /tmp not ~!
```
Because the hook was updating a variable that was not used.
Fix the hook so that before-chdir assign to the proper upvalue.