mirror of
https://git.disroot.org/FollieHiyuki/dotfiles.git
synced 2024-11-25 00:38:23 -05:00
30ed001766
Also WMs: clean up application rules
31 lines
951 B
Bash
Executable File
31 lines
951 B
Bash
Executable File
#!/usr/bin/env sh
|
|
|
|
# Description: cd to any dir in the z database using an fzf pane
|
|
#
|
|
# Shell: POSIX compliant
|
|
# Author: Nick Waywood
|
|
|
|
. "$(dirname "$0")"/.nnn-plugin-helper
|
|
|
|
if type fzf >/dev/null 2>&1; then
|
|
fuzzy="fzf --no-multi"
|
|
else
|
|
exit 1
|
|
fi
|
|
|
|
if command -v zoxide >/dev/null; then
|
|
sel=$(zoxide query --list | $fuzzy)
|
|
else
|
|
datafile="${_ZL_DATA:-$HOME/.local/share/zlua/zlua}"
|
|
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}' "$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 pane
|
|
# sel=$(awk -F "|" '{printf "%s %s\n", $2, $1}' "$datafile" | $fuzzy | sed 's/^[0-9,.]* *//' | awk '{$1=$1};1')
|
|
else
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
printf "%s" "0c$sel" > "$NNN_PIPE"
|