Code Monkey home page Code Monkey logo

zsh-z's Introduction

Zsh-z

MIT License Zsh version 4.3.11 and higher GitHub stars

Zsh-z demo

Zsh-z is a command line tool that allows you to jump quickly to directories that you have visited frequently in the past, or recently -- but most often a combination of the two (a concept known as "frecency"). It works by keeping track of when you go to directories and how much time you spend in them. It is then in the position to guess where you want to go when you type a partial string, e.g., z src might take you to ~/src/zsh. z zsh might also get you there, and z c/z might prove to be even more specific -- it all depends on your habits and how much time you have been using Zsh-z to build up a database. After using Zsh-z for a little while, you will get to where you want to be by typing considerably less than you would need if you were using cd.

Zsh-z is a native Zsh port of rupa/z, a tool written for bash and Zsh that uses embedded awk scripts to do the heavy lifting. It was quite possibly my most used command line tool for a couple of years. I decided to translate it, awk parts and all, into pure Zsh script, to see if by eliminating calls to external tools (awk, sort, date, sed, mv, rm, and chown) and reducing forking through subshells I could make it faster. The performance increase is impressive, particularly on systems where forking is slow, such as Cygwin, MSYS2, and WSL. I have found that, in those environments, switching directories using Zsh-z can be over 100% faster than it is using rupa/z.

There is a noteworthy stability increase as well. Race conditions have always been a problem with rupa/z, and users of that utility will occasionally lose their .z databases. By having Zsh-z only use Zsh (rupa/z uses a hybrid shell code that works on bash as well), I have been able to implement a zsh/system-based file-locking mechanism similar to the one @mafredri once proposed for rupa/z. It is now nearly impossible to crash the database, even through extreme testing.

There are other, smaller improvements which I try to document in Improvements and Fixes. These include the new default behavior of sorting your tab completions by frecency rather than just letting Zsh sort the raw results alphabetically (a behavior which can be restored if you like it -- see below).

Zsh-z is a drop-in replacement for rupa/z and will, by default, use the same database (~/.z), so you can go on using rupa/z when you launch bash.

Table of Contents

News

Here are the latest features and updates.
  • August 24, 2023
    • Zsh-z will now run when setopt NO_UNSET has been enabled (props @ntninja).
  • August 23, 2023
    • Better logic for loading zsh/files (props @z0rc)
  • August 2, 2023
    • Zsh-z still uses the zsh/files module when possible, but will fall back on the standard chown, mv, and rm commands in its absence.
  • April 27, 2023
    • Zsh-z now allows the user to specify the directory-changing command using the ZSHZ_CD environment variable (default: builtin cd; props @basnijholt).
  • January 27, 2023
    • If the datafile directory specified by ZSHZ_DATA or _Z_DATA does not already exist, create it (props @mattmc3).
  • June 29, 2022
    • Zsh-z is less likely to leave temporary files sitting around (props @mafredri).
  • June 27, 2022
    • A bug was fixed which was preventing paths with spaces in them from being updated (#61).
    • If writing to the temporary database file fails, the database will not be clobbered (props @mafredri).
  • December 19, 2021
    • ZSH-z will now display tildes for HOME during completion when ZSHZ_TILDE=1 has been set.
  • November 11, 2021
    • A bug was fixed which was preventing ranks from being incremented.
    • --add has been made to work with relative paths and has been documented for the user.
  • October 14, 2021
    • Completions were being sorted alphabetically, rather than by rank; this error has been fixed.
  • September 25, 2021
    • Orthographical change: "Zsh," not "ZSH."
  • September 23, 2021
    • z -xR will now remove a directory and its subdirectories from the database.
    • z -x and z -xR can now take an argument; without one, PWD is assumed.
  • September 7, 2021
    • Fixed the unload function so that it removes the $ZSHZ_CMD alias (default: z).
  • August 27, 2021
    • Using print -v ... -f instead of print -v to work around longstanding bug in Zsh involving print -v and multibyte strings.
  • August 13, 2021
    • Fixed the explanation string printed during completion so that it may be formatted with zstyle.
    • Zsh-z now declares ZSHZ_EXCLUDE_DIRS as an array with unique elements so that you do not have to.
  • July 29, 2021
    • Temporarily disabling use of print -v, which seems to be mangling CJK multibyte strings.
  • July 27, 2021
    • Internal escaping of path names now works with older versions of ZSH.
    • Zsh-z now detects and discards any incomplete or incorrectly formatted database entries.
  • July 10, 2021
    • Setting ZSHZ_TRAILING_SLASH=1 makes it so that a search pattern ending in / can match the end of a path; e.g. z foo/ can match /path/to/foo.
  • June 25, 2021
    • Setting ZSHZ_TILDE=1 displays the HOME directory as ~.
  • May 7, 2021
    • Setting ZSHZ_ECHO=1 will cause Zsh-z to display the new path when you change directories.
    • Better escaping of path names to deal paths containing the characters \`()[].
  • February 15, 2021
    • Ranks are displayed the way rupa/z now displays them, i.e. as large integers. This should help Zsh-z to integrate with other tools.
  • January 31, 2021
    • Zsh-z is now efficient enough that, on MSYS2 and Cygwin, it is faster to run it in the foreground than it is to fork a subshell for it.
    • _zshz_precmd simply returns if PWD is HOME or in ZSH_EXCLUDE_DIRS, rather than waiting for zshz to do that.
  • January 17, 2021
    • Made sure that the PUSHD_IGNORE_DUPS option is respected.
  • January 14, 2021
    • The z -h help text now breaks at spaces.
    • z -l was not working for Zsh version < 5.
  • January 11, 2021
    • Major refactoring of the code.
    • z -lr and z -lt work as expected.
    • EXTENDED_GLOB has been disabled within the plugin to accommodate old-fashioned Windows directories with names such as Progra~1.
    • Removed zshelldoc documentation.
  • January 6, 2021
    • I have corrected the frecency routine so that it matches rupa/z's math, but for the present, Zsh-z will continue to display ranks as 1/10000th of what they are in rupa/z -- they had to multiply theirs by 10000 to work around bash's inadequacies at dealing with decimal fractions.
  • January 5, 2021
    • If you try z foo, and foo is not in the database but ${PWD}/foo is a valid directory, Zsh-z will cd to it.
  • December 22, 2020
    • ZSHZ_CASE: when set to ignore, pattern matching is case-insensitive; when set to smart, patterns are matched case-insensitively when they are all lowercase and case-sensitively when they have uppercase characters in them (a behavior very much like Vim's smartcase setting).
    • ZSHZ_KEEP_DIRS is an array of directory names that should not be removed from the database, even if they are not currently available (useful when a drive is not always mounted).
    • Symlinked datafiles were having their symlinks overwritten; this bug has been fixed.

Installation

General observations

This plugin can be installed simply by putting the various files in a directory together and by sourcing zsh-z.plugin.zsh in your .zshrc:

source /path/to/zsh-z.plugin.zsh

For tab completion to work, _zshz must be in the same directory as zsh-z.plugin.zsh, and you will want to have loaded compinit. The frameworks handle this themselves. If you are not using a framework, put

autoload -U compinit; compinit

in your .zshrc somewhere below where you source zsh-z.plugin.zsh.

If you add

zstyle ':completion:*' menu select

to your .zshrc, your completion menus will look very nice. This zstyle invocation should work with any of the frameworks below as well.

For antigen users

Add the line

antigen bundle agkozak/zsh-z

to your .zshrc, somewhere above the line that says antigen apply.

For Oh My Zsh users

Zsh-z is now included as part of Oh My Zsh! As long as you are using an up-to-date installation of Oh My Zsh, you can activate Zsh-z simply by adding z to your plugins array in your .zshrc, e.g.,

plugins=( git z )

It is as simple as that.

If, however, you prefer always to use the latest version of Zsh-z from the agkozak/zsh-z repo, you may install it thus:

git clone https://github.com/agkozak/zsh-z ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-z

and activate it by adding zsh-z to the line of your .zshrc that specifies plugins=(), e.g., plugins=( git zsh-z ).

For prezto users

Execute the following command:

git clone https://github.com/agkozak/zsh-z.git ~/.zprezto-contrib/zsh-z

Then edit your ~/.zpreztorc file. Make sure the line that says

zstyle ':prezto:load' pmodule-dirs $HOME/.zprezto-contrib

is uncommented. Then find the section that specifies which modules are to be loaded; it should look something like this:

zstyle ':prezto:load' pmodule \
    'environment' \
    'terminal' \
    'editor' \
    'history' \
    'directory' \
    'spectrum' \
    'utility' \
    'completion' \
    'prompt'

Add a backslash to the end of the last line add 'zsh-z' to the list, e.g.,

zstyle ':prezto:load' pmodule \
    'environment' \
    'terminal' \
    'editor' \
    'history' \
    'directory' \
    'spectrum' \
    'utility' \
    'completion' \
    'prompt' \
    'zsh-z'

Then relaunch zsh.

For zcomet users

Simply add

zcomet load agkozak/zsh-z

to your .zshrc (below where you source zcomet.zsh and above where you run zcomet compinit).

For zgen users

Add the line

zgen load agkozak/zsh-z

somewhere above the line that says zgen save. Then run

zgen reset
zsh

to refresh your init script.

For Zim

Add the following line to your .zimrc:

zmodule https://github.com/agkozak/zsh-z

Then run

zimfw install

and restart your shell.

For Zinit users

Add the line

zinit load agkozak/zsh-z

to your .zshrc.

zsh-z supports zinit's unload feature; just run zinit unload agkozak/zshz to restore the shell to its state before zsh-z was loaded.

For Znap users

Add the line

znap source agkozak/zsh-z

somewhere below the line where you source Znap itself.

For zplug users

Add the line

zplug "agkozak/zsh-z"

somewhere above the line that says zplug load. Then run

zplug install
zplug load

to install zsh-z.

Command Line Options

  • --add Add a directory to the database
  • -c Only match subdirectories of the current directory
  • -e Echo the best match without going to it
  • -h Display help
  • -l List all matches without going to them
  • -r Match by rank (i.e. how much time you spend in directories)
  • -t Time -- match by how recently you have been to directories
  • -x Remove a directory (by default, the current directory) from the database
  • -xR Remove a directory (by default, the current directory) and its subdirectories from the database

Settings

Zsh-z has environment variables (they all begin with ZSHZ_) that change its behavior if you set them; you can also keep your old ones if you have been using rupa/z (they begin with _Z_).

  • ZSHZ_CMD changes the command name (default: z)
  • ZSHZ_CD specifies the default directory-changing command (default: builtin cd)
  • ZSHZ_COMPLETION can be 'frecent' (default) or 'legacy', depending on whether you want your completion results sorted according to frecency or simply sorted alphabetically
  • ZSHZ_DATA changes the database file (default: ~/.z)
  • ZSHZ_ECHO displays the new path name when changing directories (default: 0)
  • ZSHZ_EXCLUDE_DIRS is an array of directories to keep out of the database (default: empty)
  • ZSHZ_KEEP_DIRS is an array of directories that should not be removed from the database, even if they are not currently available (useful when a drive is not always mounted) (default: empty)
  • ZSHZ_MAX_SCORE is the maximum combined score the database entries can have before they begin to age and potentially drop out of the database (default: 9000)
  • ZSHZ_NO_RESOLVE_SYMLINKS prevents symlink resolution (default: 0)
  • ZSHZ_OWNER allows usage when in sudo -s mode (default: empty)
  • ZSHZ_TILDE displays the name of the HOME directory as a ~ (default: 0)
  • ZSHZ_TRAILING_SLASH makes it so that a search pattern ending in / can match the final element in a path; e.g., z foo/ can match /path/to/foo (default: 0)
  • ZSHZ_UNCOMMON changes the logic used to calculate the directory jumped to; see below (default: 0)

Case sensitivity

The default behavior of Zsh-z is to try to find a case-sensitive match. If there is none, then Zsh-z tries to find a case-insensitive match.

Some users prefer simple case-insensitivity; this behavior can be enabled by setting

ZSHZ_CASE=ignore

If you like Vim's smartcase setting, where lowercase patterns are case-insensitive while patterns with any uppercase characters are treated case-sensitively, try setting

ZSHZ_CASE=smart

ZSHZ_UNCOMMON

A common complaint about the default behavior of rupa/z and Zsh-z involves "common prefixes." If you type z code and the best matches, in increasing order, are

/home/me/code/foo
/home/me/code/bar
/home/me/code/bat

Zsh-z will see that all possible matches share a common prefix and will send you to that directory -- /home/me/code -- which is often a desirable result. But if the possible matches are

/home/me/.vscode/foo
/home/me/code/foo
/home/me/code/bar
/home/me/code/bat

then there is no common prefix. In this case, z code will simply send you to the highest-ranking match, /home/me/code/bat.

You may enable an alternate, experimental behavior by setting ZSHZ_UNCOMMON=1. If you do that, Zsh-z will not jump to a common prefix, even if one exists. Instead, it chooses the highest-ranking match -- but it drops any subdirectories that do not include the search term. So if you type z bat and /home/me/code/bat is the best match, that is exactly where you will end up. If, however, you had typed z code and the best match was also /home/me/code/bat, you would have ended up in /home/me/code (because code was what you had searched for). This feature is still in development, and feedback is welcome.

Making --add Work for You

Zsh-z internally uses the --add option to add paths to its database. @zachriggle pointed out to me that users might want to use --add themselves, so I have altered it a little to make it more user-friendly.

A good example might involve a directory tree that has Git repositories within it. The working directories could be added to the Zsh-z database as a batch with

for i in $(find $PWD -maxdepth 3 -name .git -type d); do
  z --add ${i:h}
done

(As a Zsh user, I tend to use ** instead of find, but it is good to see how deep your directory trees go before doing that.)

Other Improvements and Fixes

  • z -x works, with the help of chpwd_functions.
  • Zsh-z works on Solaris.
  • Zsh-z uses the "new" zshcompsys completion system instead of the old compctl one.
  • There is no error message when the database file has not yet been created.
  • There is support for special characters (e.g., [) in directory names.
  • If z -l only returns one match, a common root is not printed.
  • Exit status codes increasingly make sense.
  • Completions work with options -c, -r, and -t.
  • If ~/foo and ~/foob are matches, ~/foo is not the common root. Only a common parent directory can be a common root.
  • z -x and the new, recursive z -xR can take an argument so that you can remove directories other than PWD from the database.

Migrating from Other Tools

Zsh-z's database format is identical to that of rupa/z. You may switch freely between the two tools (I still use rupa/z for bash). fasd also uses that database format, but it stores it by default in ~/.fasd, so you will have to cp ~/.fasd ~/.z if you want to use your old directory history.

If you are coming to Zsh-z (or even to the original rupa/z, for that matter) from autojump, try using my jumpstart-z tool to convert your old database to the Zsh-z format, or simply run

awk -F "\t" '{printf("%s|%0.f|%s\n", $2, $1, '"$(date +%s)"')}' < /path/to/autojump.txt > ~/.z

COMPLETE_ALIASES

z, or any alternative you set up using $ZSH_CMD or $_Z_CMD, is an alias. setopt COMPLETE_ALIASES divorces the tab completion for aliases from the underlying commands they invoke, so if you enable COMPLETE_ALIASES, tab completion for Zsh-z will be broken. You can get it working again, however, by adding under

setopt COMPLETE_ALIASES

the line

compdef _zshz ${ZSHZ_CMD:-${_Z_CMD:-z}}

That will re-bind z or the command of your choice to the underlying Zsh-z function.

Known Bugs

It is possible to run a completion on a string with spaces in it, e.g., z us bi<TAB> might take you to /usr/local/bin. This works, but as things stand, after the completion the command line reads

z us /usr/local/bin.

You get where you want to go, but the detritus on the command line is annoying. This is also a problem in rupa/z, but I am keen on eventually eliminating this glitch. Advice is welcome.

zsh-z's People

Contributors

agkozak avatar basnijholt avatar bluegone avatar fdelmazo avatar frei-0xff avatar juodumas avatar mafredri avatar mattmc3 avatar mrteera avatar nightscape avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

zsh-z's Issues

Benefits over z.sh?

I see a few Improvements and Fixes at the end of the readme, but it's not clear to me as an end-user why I would use zsh-z over z.sh?

Is it more performant?

Echo directory when switching

z.lua which i briefly used had this option and i found it handy, would love to see this implemented here as well if possible.

zshz:68: bad math expression: illegal character: ^[

It seems there is something wrong with it.

λ z src
zshz:68: bad math expression: illegal character: ^[
λ zshz 
zshz:68: bad math expression: illegal character: ^[
2.75       /Users/Nasy/project
3.01       /Users/Nasy/.zinit/plugins/Aloxaf---fzf-tab/test
5.50       /Users/Nasy/src/pdm
6.86       /Users/Nasy/.zinit
11.03      /Users/Nasy/project/njit/multi-hop-qa/nsf_es_backend
56.68      /Users/Nasy/.config/nasy-emacs
67.55      /Users/Nasy/.zinit/plugins/Aloxaf---fzf-tab
135.97     /Users/Nasy/src/bat

compinit takes ~2s

With zsh 5.7.1 (x86_64-pc-linux-gnu) zsh takes ~2s to source a ~/.zshrc containing

source "/path/to/zsh-z/zsh-z.plugin.zsh"
autoload -U compinit && compinit

No framework is used and ~/.z contains two lines.

Failed to jump to path containing CJK characters

When there are entries containing CJK characters in the database, z -l can list them just fine but jumping or z -e fails. It seems to me that multi-byte characters are corrupted somehow.

ocean@Satori ~ % export ZSHZ_DATA=/tmp/nothing
ocean@Satori ~ % pushd TW4791主包内容
ocean@Satori TW4791主包内容 % popd
ocean@Satori ~ % z -l TW
29985      ~/TW4791主包内容
ocean@Satori ~ % z -e TW
~/TW4791主僣
ocean@Satori ~ % z TW
ocean@Satori ~ % # Note jumping failed silently
ocean@Satori ~ % cat /tmp/nothing 
/home/ocean/TW4791主包内容|1|1627470210
ocean@Satori ~ % # The database itself seems fine

OS: Gentoo Linux
zsh version: zsh 5.8 (x86_64-pc-linux-gnu)
zsh-z version: a7fa3bb (current master branch)

How to load zsh-z into Prezto?

How to load zsh-z into Prezto? It would be insert into this file .zpreztorc. But I don't know the plugin name in Prezto.

Feature: Prefer directories which contain a .git directory, if query matches repo directory name

I use zsh-z primarily to jump between various directories that are tracked as git repositories.

Occasionally, there will be a higher-'frecency' match that is a subpath of some repository, when I really want to change to a repository that matches the query.

It would be nice if zsh-z had an optional flag to prioritize directories which contain a .git directory. This could be done at scoring time, or at invocation-time (i.e. of all matches for query QUERY, take the first one that has a .git directory, if the directory name itself matches QUERY, otherwise the most 'frecent' directory). This would only take effect if the query were a match for the name of the repository itself, so that e.g. z somedir doesn't drop me at the root of the repository, but would behave as it does not normally.

TL;DR An environment variable that prioritizes git repository roots if the search query matches the directory name containing a git repository (but queries for subpaths that do not match the repo name are unchanged).

Examples

I want to change to the git repository that has 'iob' in the name. I recently spent some time in a completely unrelated directory that has 'iob' somewhere run its subpath, and it is now ranked higher. This is undesirable for my use case.

Current behavior

~ ❯❯❯ z iob
~/s/C/m/m/IOBxxx/P/somedir ❯❯❯

Desired behavior

~ ❯❯❯ z iob
~/s/C/iobXYZ ❯❯❯ ls -d .git
.git

z command stops working after running zsh as root

After starting a shell with root and run some cd commands, z stops working when switching back to normal user.

To Reproduce
$ sudo -s
$ cd /tmp
$ cd /usr
$ exit
$ z tmp

Expected behavior
z should continue to work and current dir should be changed to /usr.

Screenshots or recordings

System:

  • OS: macOS 10.14.6
  • Zsh version 5.7.1
  • Terminal emulator [e.g. iTerm2]

I used zsh-z from your repo instead of the ohmyzsh z plugin.
People using ohmyzsh z plugin had same issues here's the issue link .
ohmyzsh/ohmyzsh#8463
Hope you can help in this.
I was not able to make it run in my user environment. So i went again into sudo mode and changed the ownership of .z directory to get back the z working for user environment .
$chown username .z

Bug/Feature: If two directories have the same score for a query, the one that matches most should win

Since I've written a script that does zshz --add $PWD for all of the source code repos I have to engage with, and set ZSHZ_MAX_SCORE=0, zshz has been better than ever.

However, it has the unfortunate side-effect of moving me to the wrong directory sometimes.

Consider the following:

$ z -l fizzbuzz
1          /Users/zachriggle/src/project/fizzbuzzservices
1          /Users/zachriggle/src/project/fizzbuzz1
1          /Users/zachriggle/src/project/fizzbuzzkext

The current code will cd into fizzbuzzkext. I think that fizzbuzz1 should win here, given that it has the most matching characters.

I expect in most cases, "the most matching characters" will end up being the shortest ${dirname:t}, so that can probably be used as a proxy.

complete_aliases breaks completion

Hi!
I use zsh-z since a long time now, but it's just recently that I dig into a little bug: I wasn't able to have the completion for the command.
I added a dirty hack at the end of my zshrc: compdef _zshz t (with ZSHZ_CMD=t).
So I finally figured out (today) that the problem appears when COMPLETE_ALIASES is set.
I also discovered today that the problem was already found with #1, I think it could be a good idea to either solve the problem… or easier to add it to the README.
Thanks for your great work ;)

Show ~ as prefix for HOME instead of absolute paths

Just a little annoying to see:

0.36       /Users/micahelliott/work
0.71       /Users/micahelliott/exp
1.07       /Users/micahelliott/exp/clj/rmq
5.05       /Users/micahelliott/exp/clj
11.17      /Users/micahelliott/exp/clj/rmq/lang1
16         /usr/local/bin
45.14      /Users/micahelliott/work/foo
58.73      /Users/micahelliott/.zplug
167.84     /Users/micahelliott/tmp

when it could be easier to read as:

0.36       ~/work
0.71       ~/exp
1.07       ~/exp/clj/rmq
5.05       ~/exp/clj
11.17      ~/exp/clj/rmq/lang1
16         /usr/local/bin
45.14      ~/work/foo
58.73      ~/.zplug
167.84     ~/tmp

oh-my-zsh: command not found

I followed this guide from the readme and got the following messages
https://github.com/agkozak/zsh-z#for-oh-my-zsh-users

/home/ibnuh/.oh-my-zsh/custom/plugins/zsh-z/zsh-z.plugin.zsh:61: command not found: ^M
/home/ibnuh/.oh-my-zsh/custom/plugins/zsh-z/zsh-z.plugin.zsh:63: command not found: ^M
/home/ibnuh/.oh-my-zsh/custom/plugins/zsh-z/zsh-z.plugin.zsh:98: parse error near `\^M'

running zsh with latest oh-my-zsh on WSL2 windows
zsh 5.8 (x86_64-ubuntu-linux-gnu)

Feature request: disambiguating subdirectories

Let me know if this already exists, but I couldn't see it in your examples.

It'd be great if we could specify fragments that match parts of the path.

Hypothetical database:

  • /some/directory/with/useful/content
  • /some/place/with/useful/content

Currently, I can enter z cont<tab> and be presented with a list to choose from. It'd be great if I could enter z pl/cont and have the pl match place, and cont match the content directory, avoiding the need to scroll around in a list.

Common root logic is ignored

When there's a common root, z chooses the shortest matching directory as I expect:

$ cat ~/.z
/Users/tekumara/code/setup|1250.4200000000001|1593232602
/Users/tekumara/code|223.405|1593230323

$ z code -l
common:    /Users/tekumara/code
737.07     /Users/tekumara/code
5002.87    /Users/tekumara/code/setup

However, the common root logic isn't applied in the following case, which gives the surprising behaviour of choosing the more frequent directory:

$ cd ~/.vscode/extensions
$ cat ~/.z
/Users/tekumara/code/setup|1252.4200000000001|1593232621
/Users/tekumara/code|223.405|1593230323
/Users/tekumara/.vscode/extensions|1|1593232655

$ z code -l
7.98       /Users/tekumara/.vscode/extensions
733.93     /Users/tekumara/code
4983.06    /Users/tekumara/code/setup

I was still expecting /Users/tekumara/code to win, despite the addition of the vscode directory.

FYI: rupa/z has the same behaviour.

Fall-back directories / glob patterns

I work with hundreds of different Git repositories, but often won't do anything in a particular repository for several months at a time. By the time I need to z somerepo, it no longer exists in the ~/.z cache of recent directories.

I've tried to remedy this with a script that cd's into all subdirectories with a .git directory, and does zshz --add $dir for each one that does.

However, even with this, it seems that entries get aged off before I eventually need them.

From zshz -l | wc -l I see that there are exactly 200 directories that are remembered. I'm not sure if this is coincidence or a hard limit (I liked at the source, and couldn't tell).

It would be nice to have either of:

  • Option for disabling the "age-off" functionality entirely
  • Disable age-off, but for subpaths of some array of paths
  • Disable age-off, but only for paths which contain a .git directory
  • Keep age-off the same, but in the event there are NO matches for a e.g. zshz foo, use a user-defined array of glob expressions and go with the best match

zsh-z not following description format

this is how my completion description look
image

but with zsh-z it's just white text. It's not following my description format
image

my completion description format
zstyle ':completion:*:descriptions' format '%U%B%F{cyan}%d%f%u'

Regular expression support

Not sure to what extent the original z supports regular expressions, but I miss having the ability to add $ to the end to ensure the directory ends in the given text.

z example$

The above example would go to ~/example even if ~/example/foo has a higher score.

_zshz_update_datafile:37: division by zero

I installed zsh-z using oh-my-zsh and after each command the following line appeared:

_zshz_update_datafile:37: division by zero

I tried using zinit and it kept appearing.

When I removed zsh-z from my .zshrc, this repeating line stopped appearing.

My .zshrc:

### Added by Zinit's installer
if [[ ! -f $HOME/.zinit/bin/zinit.zsh ]]; then
    print -P "%F{33}▓▒░ %F{220}Installing %F{33}DHARMA%F{220} Initiative Plugin Manager (%F{33}zdharma/zinit%F{220})…%f"
    command mkdir -p "$HOME/.zinit" && command chmod g-rwX "$HOME/.zinit"
    command git clone https://github.com/zdharma/zinit "$HOME/.zinit/bin" && \
        print -P "%F{33}▓▒░ %F{34}Installation successful.%f%b" || \
        print -P "%F{160}▓▒░ The clone has failed.%f%b"
fi

source "$HOME/.zinit/bin/zinit.zsh"
autoload -Uz _zinit
(( ${+_comps} )) && _comps[zinit]=_zinit

# Load a few important annexes, without Turbo
# (this is currently required for annexes)
zinit light-mode for \
    zinit-zsh/z-a-as-monitor \
    zinit-zsh/z-a-patch-dl \
    zinit-zsh/z-a-bin-gem-node

### End of Zinit's installer chunk

# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
  source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi

# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH

# Path to your oh-my-zsh installation.
export ZSH="/Users/angelodias/.oh-my-zsh"

# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-zsh is loaded.
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
# ZSH_THEME="robbyrussell"
ZSH_THEME="powerlevel10k/powerlevel10k"

DEFAULT_USER="angelo"

plugins=( git node osx http npm zsh-z )

source $ZSH/oh-my-zsh.sh

export PATH=/usr/local/bin:$PATH

# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh

# KEY BINDING
bindkey -e
bindkey '^[[1;9C' forward-word
bindkey '^[[1;9D' backward-word
prompt_context () { }

NPM_PACKAGES=/Users/angelodias/.npm-packages

export NVM_DIR="/Users/angelodias/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"  # This loads nvm

# ALIASES
alias srcz="source ~/.zshrc"
alias config="code ~/.zshrc"
alias g="cd ~/git"
alias boot="cd ~/git/bootcamp/"
alias mongo-terminate="pkill mongod"
alias dev="yarn develop"

zinit light zsh-users/zsh-autosuggestions
zinit light zsh-users/zsh-completions
zinit light zdharma/fast-syntax-highlighting

# colorLS
source $(dirname $(gem which colorls))/tab_complete.sh
alias lc='colorls -lA --sd'
alias ls='colorls --almost-all --report --git-status --sort-dirs'

export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
export PATH="$PATH:$(yarn global bin)"
export PATH="$HOME/.config/yarn/global/node_modules/.bin:$PATH"
export ANDROID_HOME=~/android/sdk
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/platform-tools

Don't z into subdirectories

Assume I have a directory structure like:

/foo
/foo/bar
/foo/baz
/foobar

/foo is my main folder from which I cd into bar and baz on a regular basis. When I run z foo, it will now jump me to /foo/bar since it is the folder I currently use the most. But I find this counter-intuitive and would prefer to land in /foo.

A solution to this is to only match the actual directory's name, ignoring all of the parent directories.

Use add-zsh-hook

Instead of doing

zsh-z/zsh-z.plugin.zsh

Lines 536 to 545 in 7997b35

# Be careful not to load the precmd and chpwd functions
# more than once
[[ -n "${precmd_functions[(r)_zshz_precmd]}" ]] || {
precmd_functions[$(($#precmd_functions+1))]=_zshz_precmd
}
[[ -n "${chpwd_functions[(r)_zshz_chpwd]}" ]] || {
chpwd_functions[$(($#chpwd_functions+1))]=_zshz_chpwd
}

You can autoload and call add-zsh-hook to handle this.

Feature: Prefer exact matches

As always, thank you @agkozak for making the pure-Zsh port of Z.

One of the things I tend to butt up against that is that the "frecency" prefers top matches over exact matches.

This might be something to hide behind a non-default environment variable setting, but currently I have:

$ env | grep ZSHZ
ZSHZ_CASE=smart
ZSHZ_NO_RESOLVE_SYMLINKS=1

$ zshz -l git | tail -3
746426     /Users/zachriggle/github.com/git
1327925    /Users/zachriggle/github.com/zsh
2103788    /Users/zachriggle/github.com/shellcheck

$ zshz -e git
/Users/zachriggle/github.com/shellcheck

And if I do z git it will go to the shellcheck directory. Since git has an EXACT match, I'd kind of prefer that it went there instead. I dug into the code for zsh-z but, despite thinking I know how to Zsh pretty well, can't figure out how or where to add this.

I was hoping that ZSHZ_UNCOMMON would fix this, but it has different (but understandable) behavior.

$ ZSHZ_UNCOMMON=1 zshz -e git
/Users/zachriggle/github.com

It would be nice if there was an e.g. ZSHZ_PREFER_EXACT_MATCHES setting that would... prefer exact matches.

Not working on Arch Linux

z plugin stopped working on my zsh. When I type "zsh -e directory" it prints nothing and z command is working like cd command. I can't jump to a specific folder using it.

Prefer exact matches over partial ones

Background: I have some projects, which share a common prefix, let's call them foo and foo-bar. They are located in the same parent directory.

If I type z foo, z will navigate me to foo-bar, since I visit it more often. But sometimes I do actually want to visit foo! So currently my workflow goes something like this, which isn't ideal.

z foo
cd ../foo

If an exact directory suffix match can be found, would it make sense to prefer it over partial matches?

Declare ZSHZ_EXCLUDE_DIRS so that it can be appended to

I have conditionals and multiple scripts (in multiple places) where I want to add entries to ZSHZ_EXCLUDE_DIRS.

The main script should:

declare -ga ZSHZ_EXCLUDE_DIRS=( )

So that these scripts can all just append to the array, rather than having to rely on one of them to create the array, and the others to append to it, e.g.:

ZSHZ_EXCLUDE_DIRS+=( foo bar )

So that other scripts don't need to check for its existence.

if [ -z "${ZSHZ_EXCLUDE_DIRS[*]}" ]; then
  declare -ga ZSHZ_EXCLUDE_DIRS
fi

ZSHZ_EXCLUDE_DIRS+=( fizz buzz )

z consumes CPU and does not work on the experimental no-subdirectories branch

Sometimes, z doesn't really work. It will burn through one CPU core doing things, without actually entering the directory. The interesting thing is, that z -l does not have this problem and instantly lists me the results. z -e suffers from the problem again. It also depends on the used query. I don't know if it ever terminates when the bug occurs, the longest I've tried was about half an hour.

I'm on the subdirectories branch, so it may be related to this.

pushdignoredups is not respected - after using 'z' duplicates appear on the dirstack

I have the following options enabled (among others): autopushd pushdminus pushdsilent pushdtohome pushdignoredups

After using 'z', every time I visit a particular directory I see it duplicated on the dir stack (as shown by dirs -v). I seem to have worked around the problem by modifying zsh-z.plugin.zsh to add this line just after the zparseopts line:
setopt pushdignoredups

I don't know exactly why the option is not being restored when the 'z' function terminates. I would have thought the LOCAL_OPTIONS should have taken care of it? Maybe the issue is that emulate -L zsh sets various default zsh options and pushdignoredups is not enabled by default, so when the cd command runs, the dup gets added to the dir stack?

Anyway I'm using ZSH_VERSION 5.5.1 under Cygwin on Windows. I don't use any of the 'package' systems such as oh-my-zsh or the like.

sudo zsh complains about insecure directories

Running under WSL

The original z.sh works fine and I use the _Z_OWNER={username} option to access z when using sudo

Installed zsh-z.plugin.zsh and working fine as normal user but when I do sudo zsh I get the following:

zsh compinit: insecure directories, run compaudit for list.
Ignore insecure directories and continue [y] or abort compinit [n]?

a 'y' proceeds seems to work fine but I am wondering what is causing problem and now to make the error go away

Tab completion not working

Hello! First off, thank you so much for the plugin, it's awesome!

Secondly, I'm running a bare bones zsh with just a .zshrc file that I've created and for some reason tab completion does not work with z.

This is the contents of the .zshrc

bindkey -e
# End of lines configured by zsh-newuser-install

# The following lines were added by compinstall
zstyle :compinstall filename '${HOME}/.zshrc'

autoload -Uz compinit
compinit
# End of lines added by compinstall

# Allow comments even in interactive shells.
setopt interactive_comments
# Add command to history file immediately after hitting Enter
setopt inc_append_history
# Share history between terminals
setopt share_history

# Zstyle stuff
zstyle ':completion:*' menu select

# Aliases
alias ls='ls -G -F'
alias ll='ls -G -F -lh'
alias zshconfig="vim ~/.zshrc"
alias zr="source ~/.zshrc"
alias gs="git status"
alias gco="git checkout"
alias gcu="git commit --amend --no-edit"
alias gd="git diff"
alias c="code"
alias cat="bat"
alias python="python3"
alias e="open -a /Applications/Emacs.app $@"
alias em="/usr/local/bin/emacsclient -n"

## Functions
mkcdir() {
  mkdir -p -- "$1" &&
    cd -P -- "$1"
}

dclean() {
  docker stop $(docker ps -aq)
  docker rm -v $(docker ps -aq)
}

# Exports
# Remove duplicates from $PATH
typeset -U PATH path
export PATH=$PATH:$HOME/.toolbox/bin:$HOME/Library/Python/3.7/bin
export EDITOR="/Applications/Emacs.app/Contents/MacOS/Emacs"
export JAVA_HOME="$(/usr/libexec/java_home)"
export ZSH_PLUGIN_DIR="$HOME/.zsh_plugins"

# Plugins
# Z
source $ZSH_PLUGIN_DIR/zsh-z/zsh-z.plugin.zsh

Contents of z -l:

 ~ 👉 z -l
3.85       /Users/dimiha/scripts
7.78       /private/tmp
....

When I type z tm<TAB>, i don't get the path expanded to /private/tmp.

Am i doing anything wrong?

Case-insensitive "z"

It would be nice if the standard invocation of "z" were case-insensitive.

$ z -l | grep -i foo
15.99      /Users/zachriggle/foob
23.98      /Users/zachriggle/FOOa

I would assume that z foo takes me to FOOa but it does not.

$ z foo
$ pwd
/Users/zachriggle/foob

There does not seem to be an option to enable this, based on my quick perusal of zsh-z.plugin.zsh (which is how I found out that the tab-complete is case-insensitive)

Interestingly, specifying the full name (such that there are no other matches) works as you'd expect.

$ z fooa
$ pwd
/Users/zachriggle/FOOa

TL;DR: FOOa, being the highest ranked option which matches the query "foo" case-insensitively, should be used (or at least have an option to be used). This is especially the case for macOS users since the entire filesystem is case-insensitive anyway.

It looks like internally, Z checks for both case-sensitive matches and case-insensitive matches:

    if [[ $path_field == ${~q} ]]; then
      matches[$path_field]=$rank
    elif [[ ${path_field:l} == ${~q:l} ]]; then
      imatches[$path_field]=$rank
    fi

But it gives precedence to case-sensitive matches:

  # Return 1 when there are no matches
  [[ -z $best_match ]] && [[ -z $ibest_match ]] && return 1

  if [[ -n $best_match ]]; then
    _zshz_output matches best_match $format
  elif [[ -n $ibest_match ]]; then
    _zshz_output imatches ibest_match $format
  fi

-x flag is not recursive and no option to enable it

It seems odd to me that the -x flag is not recursive

I believe it would make more sense that -x should prune all child directories from the history, but I can also understand rationale of making it a separate switch, eg -X or maybe -xR

Thoughts?

Completion of `-c` option not working.

The improvements section notes that:

Completions work with options -c, -r, and -t.

But the completions with these options aren't working for me. Taking a look at the completions file, it seems like this line:

# Don't try to complete a string beginning with a hyphen
[[ ${(@)words:1} == -* ]] && return 1

Is stopping these completions from working. Is something wrong with my setup, or are these completions not supported?

Thank you for both your help and the great zsh plugin!

`-l` updates the timestamp

Running z code -l will update the timestamp of the winning code entry, and therefore its score, which I found surprising.

I was expecting this operation to be non-destructive because it doesn't change the current directory, unlike z code.

Feature: "zsh-z --add" should be exposed via -h / --help

I have a HUGE (200+) set of Git repositories that I regularly jump between. Occasionally, I'll clone something, but not cd into it, so it isn't visible to zsh-z. This is kind of annoying, since then I have to find it manually.

Desired Goal

I would like to be able to do something like this:

find $PWD -maxdepth 3 -name .git -type d \
    | xargs dirname \
    | sort \
    | while read dir; do 
        echo $dir
        z -a $dir
    done

To add all of the directories which contain a .git directory in them, to the zsh-z database. Simply doing a cd $dir is insufficient, since zsh-z populates on one of the prompt-hooks (not sure if it's pre- or post-) which is not executed.

Further Investigation Yields Results

It looks like I might be able to manually invoke _zshz_add_or_remove_path, and looking at the source for _zshz_precmd it looks like it makes use of zshz --add "$dir" -- so perhaps this functionality is already present, but is not exposed via z --help?

This does seem to work in practice! (Yay!)

$ randpass
sCBMyTuAJ6oDzL3S4iZjDQ==

$ mkdir sCBMyTuAJ6oDzL3S4iZjDQ==

$ z --add sCBMyTuAJ6oDzL3S4iZjDQ==

$ z 3S4i

$ pwd
/Users/zachriggle/sCBMyTuAJ6oDzL3S4iZjDQ==

Closing Remarks

It looks like this functionality is already implemented, but is not exposed via -h / --help. Might be useful to add it.

Thanks in advance!

Conflicts with RVM

I installed RVM and source it in .zshrc like source /usr/local/rvm/scripts/rvm, and when I use zsh-z (command like z etc), it shows error like this:

/usr/local/rvm/scripts/initialize:59: array parameter rvm_rvmrc_files created globally in function __rvm_do_with_env_before
/usr/local/rvm/scripts/initialize:101: scalar parameter rvm_scripts_path created globally in function __rvm_do_with_env_before
/usr/local/rvm/scripts/initialize:111: scalar parameter rvm_user_install_flag created globally in function __rvm_do_with_env_before
/usr/local/rvm/scripts/initialize:117: scalar parameter rvm_man_path created globally in function __rvm_do_with_env_before
/usr/local/rvm/scripts/initialize:117: scalar parameter rvm_archives_path created globally in function __rvm_do_with_env_before
/usr/local/rvm/scripts/initialize:117: scalar parameter rvm_docs_path created globally in function __rvm_do_with_env_before
/usr/local/rvm/scripts/initialize:117: scalar parameter rvm_environments_path created globally in function __rvm_do_with_env_before
/usr/local/rvm/scripts/initialize:117: scalar parameter rvm_examples_path created globally in function __rvm_do_with_env_before
/usr/local/rvm/scripts/initialize:117: scalar parameter rvm_gems_path created globally in function __rvm_do_with_env_before
/usr/local/rvm/scripts/initialize:117: scalar parameter rvm_gemsets_path created globally in function __rvm_do_with_env_before
/usr/local/rvm/scripts/initialize:117: scalar parameter rvm_help_path created globally in function __rvm_do_with_env_before
/usr/local/rvm/scripts/initialize:117: scalar parameter rvm_hooks_path created globally in function __rvm_do_with_env_before
/usr/local/rvm/scripts/initialize:117: scalar parameter rvm_lib_path created globally in function __rvm_do_with_env_before
/usr/local/rvm/scripts/initialize:117: scalar parameter rvm_log_path created globally in function __rvm_do_with_env_before
/usr/local/rvm/scripts/initialize:117: scalar parameter rvm_patches_path created globally in function __rvm_do_with_env_before
/usr/local/rvm/scripts/initialize:117: scalar parameter rvm_repos_path created globally in function __rvm_do_with_env_before
/usr/local/rvm/scripts/initialize:117: scalar parameter rvm_rubies_path created globally in function __rvm_do_with_env_before
/usr/local/rvm/scripts/initialize:117: scalar parameter rvm_src_path created globally in function __rvm_do_with_env_before
/usr/local/rvm/scripts/initialize:117: scalar parameter rvm_tmp_path created globally in function __rvm_do_with_env_before
/usr/local/rvm/scripts/initialize:117: scalar parameter rvm_user_path created globally in function __rvm_do_with_env_before
/usr/local/rvm/scripts/initialize:117: scalar parameter rvm_usr_path created globally in function __rvm_do_with_env_before
/usr/local/rvm/scripts/initialize:117: scalar parameter rvm_wrappers_path created globally in function __rvm_do_with_env_before
/usr/local/rvm/scripts/initialize:117: scalar parameter rvm_verbose_flag created globally in function __rvm_do_with_env_before
/usr/local/rvm/scripts/initialize:117: scalar parameter rvm_debug_flag created globally in function __rvm_do_with_env_before
/usr/local/rvm/scripts/initialize:117: scalar parameter rvm_gems_cache_path created globally in function __rvm_do_with_env_before
(eval):1: array parameter _hooks_list created globally in function __rvm_read_lines
/usr/local/rvm/scripts/hook:36: scalar parameter hook created globally in function __rvm_after_cd

I think maybe zsh-z is conflict with RVM?

Add option to disable removal of non-existent paths

I have most of my data on a secondary drive. Since this drive is encrypted, it is not auto-mounted. Every time I run z while the drive is not mounted, all of my entries are removed, which makes it basically useless for the long term.

It would be great if an option to prevent removal would exist. This implementation might be enough:

diff --git a/zsh-z.plugin.zsh b/zsh-z.plugin.zsh
index 98e029a..8cad69f 100644
--- a/zsh-z.plugin.zsh
+++ b/zsh-z.plugin.zsh
@@ -56,6 +56,7 @@
 #     ZSHZ_NO_RESOLVE_SYMLINKS -> '1' prevents symlink resolution
 #     ZSHZ_EXCLUDE_DIRS -> array of directories to exclude from your database
 #     ZSHZ_OWNER -> your username (if you want use ZSH-z while using sudo -s) }}}
+#     ZSHZ_NO_REMOVE_NONEXIST -> '1' prevents removal of nonexistent paths from the data file
 #
 # vim: fdm=indent:ts=2:et:sts=2:sw=2:
 
@@ -198,11 +199,13 @@ _zshz_update_datafile() {
   # Load the datafile into an array
   lines=( ${(f)"$(< $datafile)"} ) 2> /dev/null
 
-  # Remove paths from database if they no longer exist
-  for line in $lines; do
-    [[ -d ${line%%\|*} ]] && existing_paths+=( $line )
-  done
-  lines=( $existing_paths )
+  if (( ! ZSHZ_NO_REMOVE_NONEXIST )); then
+    # Remove paths from database if they no longer exist
+    for line in $lines; do
+      [[ -d ${line%%\|*} ]] && existing_paths+=( $line )
+    done
+    lines=( $existing_paths )
+  fi
 
   for line in $lines; do
     path_field=${line%%\|*}

z overwrites symlinks

I keep important dotfiles in a git repository and link to them from my home directory, like

ln -s ~/my_git_repos/dotfiles/.z ~/.z

The database gets always overwritten by z every time it is executed successfully.

It would be nice if z could follow symlinks instead of overwriting them.

ZSHZ_NO_RESOLVE_SYMLINKS does not work

I set export ZSHZ_NO_RESOLVE_SYMLINKS=1 in my .zshrc, but when I cd into a symlink, it still adds the path behind the symlink to the history and not the symlink itself.

Integrating with ranger

Hi,
I was a user of z, thank you for creating this project.

I had created a jumper for ranger using z, this. The current implementation uses python regex for searching the pattern in the z file.

Is there any way i can use your project as standalone command in python subprocess, like z -e directory-name.

Make it XDG compliant

Making the extension XDG compliant should be pretty straightforward: Simply replace local datafile=${ZSHZ_DATA:-${_Z_DATA:-${HOME}/.z}} with local datafile=${ZSHZ_DATA:-${_Z_DATA:-${XDG_DATA_HOME:-$HOME/.local/share}/zsh/z}} (not tested).

Implementing it in a backwards-compatible way is a bit less straightforward though: The default file path case needs to check the legacy location in home first and then handle if it exists.

Fantasic script, works great with zimfw

Thanks for your work on this. I've selected it over z, autojump and pazi.

I'm using zimfw and zsh-z works great by cloning into .zimfw/modules/zsh-z and then enabling it as a module in .zimrc.

I did need to add autoload -U compinit && compinit to .zshrc for tab autocompletion.

Your delightfully helpful approach on the few issues I saw here was the clincher for installing. Thanks again and feel free to close this issue.

Bug: Incorrect search results from `z` and `z -l`

Today, z took me to the wrong directory! It was a valid directory, but not the one that likely should have been selected. I wanted the one with the score 219, I got one with a score of 4.

Removing the score-4 entry from the list reverted to correct behavior. Not sure how I can help out to debug this (since I can't provide my ~/.z file (it's on a work computer) but thought it was still worth reporting.

It might be useful to have a -v option to z that explains why a particular directory was selected, to help diagnose this. I think in this case, it was due to the "recent access" being used, rather than "rank". I'll update my shell to alias z=z -r to avoid this in the future.

What makes me think this is an ACTUAL bug, is that the first z -l does not show all of the other matches, they only show up after removing that specific directory.

$ z omni

$ pwd
/Applications/OmniFocus 3.4.1.app

$ z -l omni
4          /Applications/OmniFocus 3.4.1.app

$ z -x .

$  z -l omni
1.10       /Users/zachriggle/omni2/omni
1.58       /Users/zachriggle/omni/completions
2.79       /Users/zachriggle/omni2
5.86       /Users/zachriggle/Library/Containers/com.omnigroup.OmniFocus3
13.37      /Users/zachriggle/omni/omni
219.10     /Users/zachriggle/omni

Expanding directories broken since d421d84

I'm using this on the native zsh 5.7.1 on macOS Catalina 10.15.7. See my dotfiles here for details: https://github.com/levito/dotfiles

Assuming I have a directory ~/foo/bar, and I enter z bar[tab]:

Before d421d84, this was expanded to ~/foo/bar/ like expected. (https://github.com/rupa/z behaves the same way)

After that commit, it will be expanded to Users/xxx/foo/bar/ – notice the missing leading /.

This might relate to #29.

Edit: The same happens to paths outside of $HOME, e. g. /Applitactions, triggered with z Appl[tab]:

Before d421d84, this is expanded correctly to /Applications/.

After that commit, it expands to Applications/ with the leading / missing.

_zshz_find_matches:68: error in flags

�I installed this plugin on my mac and centos 7 manually. Both use the same config.
But mac runs perfectly, centos not, and leaves "_zshz_find_matches:68: error in flags" message on my terminal.
Any idea to fix this? Thx in advance.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.