aboutsummaryrefslogtreecommitdiff
path: root/.zrc
blob: 5856f5cb3b1e0800845254e8dd179462aa718e1c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/env bash

[[ -r /usr/share/z/z.sh ]] && source /usr/share/z/z.sh
[[ -r /usr/local/etc/profile.d/z.sh ]] && source /usr/local/etc/profile.d/z.sh

[ ! -f /usr/share/z/z.sh -a ! -f /usr/local/etc/profile.d/z.sh ] && return

if command -v fzf &> /dev/null; then
    unalias j 2> /dev/null

    j () {
        [ $# -gt 0 ] && _z "$*" && return
        cd "$(_z -l 2>&1 | fzf --height 40% --nth 2.. --reverse --inline-info +s --tac --query "${*##-* }" | sed 's/^[0-9,.]* *//')"
    }
else
    export _Z_CMD='j'
fi