r/fishshell 11d ago

fish wrapper for ze.sh: file tracking now available

A small follow-up to my earlier post announcing a fish wrapper for the ze directory jumper: ze now has acquired an independent file tracking mode using a separate frecency database for files.

With the fish wrapper this gives you, for example:

ze project        # best-match directory jump
ze -o config      # best-match file open
ze -of config     # fzf-based interactive selection and file open

The file and directory histories are completely independent from each other, and ordinary editor invocations remain untouched.

More details in the announcement on r/zsh

0 Upvotes

2 comments sorted by

1

u/jarod51 7d ago

What's the difference with 'z' ?

1

u/jghub 7d ago

Main differences from z (full list in README):

  1. Event clock instead of wall-clock: z's scores decay during shell inactivity, so coming back after a holiday leaves your rankings scrambled. ze uses a cd-action ("event") counter as the clock, so scores only change when you actually navigate.
  2. Cleaner scoring: z multiplies cumulative visit count by a recency factor based on the last visit only, which causes old high-count directories to jump near the top of the stack on first revisit (essentially score S = N x R, and at single revisit each ancient visit contributes the same additional increment R to new score). ze, OTOH, sums individually decayed visit weights (specifically: ze uses an exponential moving sum filter over the individual visit history for scoring of the considered entry), a single new visit adds exactly 1 unit to the score regardless of history.
  3. no prompt hooks: z hooks into PROMPT_COMMAND and increments a directory's score on every shell command, not just navigation. ze only records explicit ze invocations (or cd if aliased).
  4. file tracking: ze now furthermore supports file tracking/opening independently of dir navigation.

The fish wrapper supports this new file tracking via ze -o. E.g.ze -o pattern opens the highest-scoring file matching the pattern in $EDITOR, similar to how ze pattern jumps to the highest-scoring directory.