Skip to content

xuchunyang/eshell-z

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

76 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

eshell-z https://travis-ci.org/xuchunyang/eshell-z.svg?branch=master https://melpa.org/packages/eshell-z-badge.svg https://stable.melpa.org/packages/eshell-z-badge.svg

Introduction

The eshell-z package is an Emacs port of z. It keeps track of where you’ve been and how many commands you invoke there, and provides a convenient way to jump to the directories you actually use. eshell-z and z can work together by sharing the same data file.

Table of Contents

Install

MELPA

After setting up MELPA as a repository, use M-x package-install eshell-z or your preferred method.

Manually

Add eshell-z to your load-path. Something like

(add-to-list 'load-path "path/to/eshell-z")

Setup

To use this package, add following code to your init.el or .emacs

(add-hook 'eshell-mode-hook
          (defun my-eshell-mode-hook ()
            (require 'eshell-z)))

Usage

~ $ z -h
usage: z [-chlrtx] [regex1 regex2 ... regexn]

    -c, --current        estrict matches to subdirectories of the current directory
    -h, --help           show a brief help message
    -l, --list           list only
    -r, --rank           match by rank only
    -t, --time           match by recent access only
    -x, --delete         remove the current directory from the datafile

examples:

    z foo         cd to most frecent dir matching foo
    z foo bar     cd to most frecent dir matching foo, then bar
    z -r foo      cd to highest ranked dir matching foo
    z -t foo      cd to most recently accessed dir matching foo
    z -l foo      list all dirs matching foo (by frecency)

Notations

NOTICE This section is copied from the manpage of z.

Aging

The rank of directories maintained by z undergoes aging based on a simple formula. The rank of each entry is incremented every time it is accessed. When the sum of ranks is over 9000, all ranks are multiplied by 0.99. Entries with a rank lower than 1 are forgotten.

Frecency

Frecency is a portmanteau of ‘recent’ and ‘frequency’. It is a weighted rank that depends on how often and how recently something occurred. As far as I know, Mozilla came up with the term.

To z, a directory that has low ranking but has been accessed recently will quickly have higher rank than a directory accessed frequently a long time ago.

Frecency is determined at runtime.

Common

When multiple directories match all queries, and they all have a common prefix, z will cd to the shortest matching directory, without regard to priority. This has been in effect, if undocumented, for quite some time, but should probably be configurable or reconsidered.

Tab Completion

z supports basic tab completion, press TAB to complete on options and directories. This is implemented with pcomplete.

See also