aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuangxiong Lin <[email protected]>2022-03-26 18:46:35 +0800
committerGuangxiong Lin <[email protected]>2022-03-26 18:46:35 +0800
commit964332d61e6dc9f6c42050cfacafb830fbead1e6 (patch)
tree660c0982e2264f640b13d3ea580c5ded48088619
parent9892efdeb78273f72b2987f72673dd38eecec5d7 (diff)
downloaddotfiles-964332d61e6dc9f6c42050cfacafb830fbead1e6.tar.gz
dotfiles-964332d61e6dc9f6c42050cfacafb830fbead1e6.tar.bz2
dotfiles-964332d61e6dc9f6c42050cfacafb830fbead1e6.zip
Update the config of z
-rw-r--r--.env2
-rwxr-xr-x.zrc16
-rw-r--r--.zshrc1
3 files changed, 17 insertions, 2 deletions
diff --git a/.env b/.env
index 6bbc65c..ee9b730 100644
--- a/.env
+++ b/.env
@@ -6,8 +6,6 @@ BROWSER='firefox --new-tab'
[ -e '/usr/bin/qutebrowser' ] && BROWSER='/usr/bin/qutebrowser'
export BROWSER=$BROWSER
-[ -f /usr/share/z/z.sh -o -f /usr/local/etc/profile.d/z.sh ] && export _Z_CMD='j'
-
if type fcitx5 > /dev/null; then
export GTK_IM_MODULE=fcitx
export QT_IM_MODULE=fcitx
diff --git a/.zrc b/.zrc
new file mode 100755
index 0000000..6b289fa
--- /dev/null
+++ b/.zrc
@@ -0,0 +1,16 @@
+#!/usr/bin/env bash
+
+if [ ! -f /usr/share/z/z.sh -a ! -f /usr/local/etc/profile.d/z.sh ]; then
+ return
+fi
+
+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
diff --git a/.zshrc b/.zshrc
index 0bb8fd3..06269b2 100644
--- a/.zshrc
+++ b/.zshrc
@@ -22,6 +22,7 @@ source $HOME/.path
source $HOME/.env
source $HOME/.aliases
source $HOME/.functions
+source $HOME/.zrc
[[ -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