Comments (5)
It's easy enough to implement - zoxide is designed with scriptability in mind. What you're asking for can be achieved with a simple one line function:
function z() { cd "$(zoxide query -- "$@")" }
from zoxide.
z
behaves first like a cd command, and then like a "jump" command. This is so that you don't have to build muscle memory for two commands (should I cd into this directory, or use z?)
The only way to solve this particular case is to use a query that will not match a local directory. Here's some alternatives:
z api
z / go
z a go
from zoxide.
Thanks for your response. I am aware of the workarounds, but the example I gave is one of many. The issue - for me at least - is that although z
is designed to replace cd
, it isn't cd
on account of its additional fuzzy matching db capability.
z
can fuzzy match or exact match, but the behaviour is dependent upon which directory a user is already in. That's confusing for the user: will z go
change to an immediate subdirectory called go
or will it fuzzy match from its database?
What I'm suggesting is to make that semantically clear, or to provide that as an option. It makes more sense to me at least. Operands resulting in a physical pathspec behave like cd
and in all other cases fuzzy matching from the database.
from zoxide.
Wasn't aware of that - thanks. However, that's not quite what I'm looking for. The above only works with parameters that match entries in the db, and doesn't work in situations where I want to do a straight cd
with a pathspec eg:
z ./go
or z /home/user/go
Sorry to trouble you further, but is it straightforward to achieve that? So if I'm in ~
and I type z go
it matches from the db, but only does a cd
when a pathspec is provided ie. z ./go
?
Appreciate for your help 🙂
from zoxide.
As far as Linux is concerned, cd foo
is identical to cd ./foo
. Both are relative paths.
You could certainly write a custom script that only tries to manually cd
if the directory contains a /
in it, and falls back to zoxide otherwise - should solve your problem.
from zoxide.
Related Issues (20)
- zoxide: no match found
- Error: zoxide has not yet been packaged for your architecture HOT 3
- Directory Color Issues in Interactive Mode HOT 2
- .zoxide.nu method breaks with the latest 0.94.0 release HOT 3
- Nushell failure on `z` for keyword not under $env.PWD HOT 1
- Interactive completions when using powershell
- error: unrecognized subcommand 'Documents' HOT 2
- Trying to implement a go back and go forward
- Multidot navigation
- zoxide resets every time I shut off my mac HOT 1
- Cannot run shell installer on WSL2 Ubuntu 22.04 HOT 3
- Errors when accessing network drive on windows via git bash
- [Bug Report]: No directory history in the database, check out the `zoxide` docs to set it HOT 1
- `zi` doesn't work HOT 2
- `zoxide` does not work HOT 3
- no match found HOT 3
- Easier flow for bumping path to be top result for query
- Add support for bash autocd option HOT 1
- Add support for regexp
- Ability to disable cd-like behavior
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from zoxide.