Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ Zsh-z has environment variables (they all begin with `ZSHZ_`) that change its be
* `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_DATA` changes the database file (default: `$ZDOTDIR/.z` falls back to `~/.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)
Expand Down
9 changes: 6 additions & 3 deletions zsh-z.plugin.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
# ZSHZ_CMD -> name of command (default: z)
# ZSHZ_COMPLETION -> completion method (default: 'frecent'; 'legacy' for
# alphabetic sorting)
# ZSHZ_DATA -> name of datafile (default: ~/.z)
# ZSHZ_DATA -> name of datafile (default: $ZDOTDIR/.z else ~/.z)
# ZSHZ_EXCLUDE_DIRS -> array of directories to exclude from your database
# (default: empty)
# ZSHZ_KEEP_DIRS -> array of directories that should not be removed from the
Expand Down Expand Up @@ -170,9 +170,12 @@ zshz() {
exit
fi

# If the user specified a datafile, use that or default to ~/.z
# If the user specified a datafile, use it else default to $ZDOTDIR/.z otherwise default to $HOME/.z
# If the datafile is a symlink, it gets dereferenced
local datafile=${${custom_datafile:-$HOME/.z}:A}
local datafile=$custom_datafile
: ${datafile:=$HOME/.z}
[[ -f $datafile ]] || datafile=${ZDOTDIR:-$HOME}/.z
datafile=${datafile:A}

# If the datafile is a directory, print a warning and exit
if [[ -d $datafile ]]; then
Expand Down