Live data from Hacker News

Behold z, the unsung jewel that rethinks shell navigation

aymericbeaumet.com

21–30 of 71 posts

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

#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.

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

#24
I use 'cz' which is like 'cd' but for git workspaces only. Uses fzf to present list of matches.

bash source:

cz-index () { sudo find -L ~/work -type d -name '.git' | sed 's;/.git$;;' | sort > ~/git-dirs.txt }

cz () { cd "$(cat ~/git-dirs.txt | fzf --tiebreak=begin --exact -i -q $1)" }

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

#25
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 z absolutely wonderful to take away that first hurdle of remembering folders. I can't imagine how Windows devs who don't know Unix can get around easily. They seem to though. Much must be memorised and some tools help. Powershell is getting better, but I think lacks (at least for the moment) the amount of existing code/books/links that shell solutions have.

I sometimes hum my version of that old Sting favourite,

   Oh, I'm an alien, I'm a legal alien
   I'm a Linux dev in Windows 10....
I'd be interested to hear if there are better/equivalent searching tools easily available on Windows, but z works wonderfully for me.

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

#28

Earlier quoted context omitted.

Besides z being much faster (looking through a sorted list of directories visited instead of recursively walking from the current directory) your snippet looks from the cwd

This is a fair point. I usually only "jump" from directories that have at most 500k files, and the median is way closer to ~500 files. Even in the worst cases, at least with my i7 NUC and using fd instead of find, it's less than 500ms to load the entire list into fzf.

Yep, that's fair. I use fzf along with z. I use z usually to switch projects (and I work in Go, so many are in GOPATH and annoying to CD to manually) but I use fzf both inside and outside of vim to open individual files.
Post reply on HN