Open leoshimo opened 2 years ago
Sure! I'd suggest a feature that works this way:
zoxide query
is ~
, then all results should start with $HOME
.zoxide query
is .
, then all results should start with $PWD
.You'd be able to use z . foo
and it would only match a subdirectory.
Got a working backend for this. Right now I added a zw
command which cds into a subdirectory by passing the --workingdir
flag to zoxide query
.
I got it working by making it a different command in the shell scripts, zw
, don't know enough bash to implement checking the first parameter to zoxide query
and triggering the respective behavior but it should be trivial, sound good?
This behaviour should be triggered within Rust rather than within Bash, since it would be common to all 8 shells supported by zoxide.
Aight made a pull request
I'd argue this should also be the default behavior for the z
and zi
commands, and a different command should be used for cases where the current directory context isn't relevant.
The z.lua
tool (and for some cases z
and autojump
) seems to have understood that the following is the order for how common actions are:
Option 5 already has a poor manual jump list in Linux with pushd
, popd
, dirs
, ~1/
, ~2/
, etc.
Currently I would estimate 98% of use cases a jump command wants to do something relative to their current folder (up, down, or over). Only a small number of cases want to jump to unrelated folders. Unfortunately, Zoxide currently only supports jumping to unrelated folders, and custom functions would need to be written to enable jumping to folders relative to the current (e.g. a custom function that automatically inserts the current path as the first search term).
Feature request to add additional shell commands for jumping to children for working directory, similar to
jc
in autojump.WDYT about bringing this to zoxide?
Happy to take this task on.