Live data from Hacker News

Behold z, the unsung jewel that rethinks shell navigation

aymericbeaumet.com

41–50 of 71 posts

Re: Behold z, the unsung jewel that rethinks shell navigation

#41

Is there some functionality that `z` offers that fzf doesn't? I have a keybinding that essentially does `open $(fd | fzf)`, and that is how I go _anywhere_ in my file system. Completely changed how I use the shell. I personally find that fzf is better because I can see where I'm going to end up before I accept the operation.

    I personally find that fzf is better because I can 
    see where I'm going to end up before I accept the
    operation. 
I agree that's a must-have feature. Luckily z does it as well.

Type `z foo` and hit tab.

If there's a single match, "foo" will be expanded in place to the proper path.

If there are multiple matches, you can choose from a list of paths.

So, no mystery navigation (unless you want it) -- you can always see where you're going.

Re: Behold z, the unsung jewel that rethinks shell navigation

#42
post #33

Oh-my-zsh with the fzf plugin has a lot of navigation-friction removal. cd ~/r/pr/e/de Becomes cd ~/repos/projectlongname/environments/development It also has built in push/pop, with minus always returning to the previous path, various numbers of dots, up to six I believe, navigating up the tree, and cd - showing interactive breadcrumbs of recent paths for easy as click-and-click navigation.

I think most of this is out of the box OMZ (without the fzf plugin).

Re: Behold z, the unsung jewel that rethinks shell navigation

#43
I have been using `z` for some time, and now I can't imagine working without it.

I used to have a big list of aliases like:

  alias pro='cd ~/Projects'
Seems trivial, but it was a huge time saver over time. After installing `z` and using it for a few days, I can now keep only the top 3/4 aliases and `z` does the rest.

I've been tempted to try more fancy tools like zoxide, but I love the fact that `z` is just a shell script I can easily move around.

Re: Behold z, the unsung jewel that rethinks shell navigation

#44
post #34

z is amazing. z and fish shell are the two biggest shell productivity boosters I've ever used.

How do you install z on fish? z.sh is supposed to be sourced, but that won't work in config.fish.

Other than the already mentioned zoxide, there's also https://github.com/jethrokuan/z

Re: Behold z, the unsung jewel that rethinks shell navigation

#45
OP here, thanks for the amazing comments. Some nice projects to look into!

As much as I love z, I'm also a fan of fzf, both are really complementary. I'm using this little piece of code (not from me, but cannot find the original source) to fallback to fuzzy search when z fails to find a result or when no args are given:

  unalias z &> /dev/null
  z() {
    [ $# -gt 0 ] && _z "$*" && return
    cd "$(_z -l 2>&1 | fzf --nth 2.. +s --tac --query "${*##-* }" | sed 's/^[0-9,.]* *//')" || exit 1
  }
I also use this approach in a few other places in my workflow (git checkout, vim, etc). Expect a blog post covering this in the near future.

Re: Behold z, the unsung jewel that rethinks shell navigation

#47
post #21
post #17

I'm mildly skeptical of any shortcuts that are based on "learning habits". I've already gotten enough of user interfaces that move items based on use all the time (The spotify playlist list is the worst offender - playlists move up and down in rank after every use, so there is never any spatial memory, startled every time).

You press z, type a few letters and then hit tab until you get the thing you want. It's not spatial. If you use ctrl-r frequently it's similar.

Is there any advantage over CTRL-R?

Re: Behold z, the unsung jewel that rethinks shell navigation

#48
post #21
post #17

I'm mildly skeptical of any shortcuts that are based on "learning habits". I've already gotten enough of user interfaces that move items based on use all the time (The spotify playlist list is the worst offender - playlists move up and down in rank after every use, so there is never any spatial memory, startled every time).

You press z, type a few letters and then hit tab until you get the thing you want. It's not spatial. If you use ctrl-r frequently it's similar.

The examples show "z someinput" and enter, so then going to some place based on learned location for someinput, no?

It's not spatial because it's text-based but a similar problem occurs if it can surprise you about which location is going to be used for each input.

Re: Behold z, the unsung jewel that rethinks shell navigation

#49

I develop apps on Windows, but I use Linux to do lots of my work and automate cumbersome boring tasks where I can (there are still many more to be automated....). I'm constantly amazed at what Windows dev people can get done without a programmable command line. I've seen several thousand line long cmd/bat files to do relatively simple things. They work, which is good. They are a lot of work to maintain though. I find…

> I can't imagine how Windows devs who don't know Unix can get around easily. They seem to though.

It's simple, for filesystem operations most Windows people don't use CLI. I use Total Commander for example, which has tabs and bookmarks to quickly navigate around the filesystem.

Re: Behold z, the unsung jewel that rethinks shell navigation

#50
post #40
post #35

Earlier quoted context omitted.

I’ve used fish for quite a while but after Many a scripting incompatibility I went back to ohmyzsh. Fish is great if you can port your whole ecosystem into it.

I find the persistent directory stack of ohmyzsh (easy enough to enable yourself in zsh) easier to use than things like autojump or z, and pretty much makes them unnecessary. I miss this basic functionality in fish (hoping someone will point out that I have overlooked it)

Care to elaborate? Nowadays i usually use history with fzf to find old cd commands.
Post reply on HN