Browse Source

Support $_Z_DATA environment variable (#545)

Support `$_Z_DATA` environment variable per z's documentation dcd5541e7d/z.1 (L78).
`$_Z_DATA` allows changing the default location of the z database file.
master
step GitHub 4 years ago
parent
commit
49eecd7684
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 3 deletions
  1. +4
    -3
      plugins/fzz

+ 4
- 3
plugins/fzz View File

@@ -15,11 +15,12 @@ else
exit 1
fi

if [ -f "$HOME/.z" ]; then
datafile="${_Z_DATA:-$HOME/.z}"
if [ -f "$datafile" ]; then
# I read the data from z's file instead of calling the z command so that the data doesn't need to be processed twice
sel=$(awk -F "|" '{print $1}' "$HOME/.z" | "$fuzzy" | awk '{$1=$1};1')
sel=$(awk -F "|" '{print $1}' "$datafile" | "$fuzzy" | awk '{$1=$1};1')
# NOTE: Uncomment this line and comment out the line above if you want to see the weightings of the dir's in the fzf/fzy pane
# sel=$(awk -F "|" '{printf "%s %s\n", $2, $1}' "$HOME/.z" | "$fuzzy" | sed 's/^[0-9,.]* *//' | awk '{$1=$1};1')
# sel=$(awk -F "|" '{printf "%s %s\n", $2, $1}' "$datafile" | "$fuzzy" | sed 's/^[0-9,.]* *//' | awk '{$1=$1};1')
else
exit 1
fi


Loading…
Cancel
Save