-
Notifications
You must be signed in to change notification settings - Fork 141
FAQ
Q: There is a ~/Documents/github/vue-my-ui
directory, but when I use z vue-my-ui
the directory cannot be matched.
A: -
is a reserved character in lua regexp. you can use either z vue%-my%-ui
or z vue my ui
.
If you don't like this behavior, you can set:
export _ZL_HYPHEN=1
to escape -
into %-
automatically and z vue-my-ui
will jump to ~/Documents/github/vue-my-ui
but you cannot use -
as a regexp keywords any more.
Copy ranger_zlua.py to your ~/.config/ranger/plugins
folder, and set environment variable in your shell rc:
export RANGER_ZLUA="/path/to/z.lua"
The integration script provides a z
command in ranger. It also tracks directories changes in ranger.
Paste this script in your .bashrc
/ .zshrc
:
function j() {
if [[ "$argv[1]" == "-"* ]]; then
z "$@"
else
cd "$@" 2> /dev/null || z "$@"
fi
}
When you are using j xxx
it will first try cd xxx
and then z xxx
if cd failed.
fz is a bash/zsh plugin that seamlessly adds fuzzy search to tab completion of z.sh. z.lua
can work with it for better completion result, just define a _z
function and pass all the arguments to _zlua
before sourcing fz.sh:
FZ_HISTORY_CD_CMD="_zlua"
source /path/to/fz.sh
If you are using zsh with antigen, initialize them like this:
antigen bundle skywind3000/z.lua
antigen bundle changyuheng/fz
function _z() { _zlua "$@"; }
Issue #46 asked for a script to import some history path from bash command history after a fresh install of z.lua and @antonalekseev provided two script below:
for bash:
fc -ln -10000| sed -e 's|^'[[:blank:]]' ||'|grep -o "^cd [~/].*"|sed -e "s|cd ||" -e "s|~|$HOME|" -e 's|\\ | |' -e "s|/$||"|sort|uniq|while read -r d; do test -d "$d" && echo "$d|1|0"; done >> ~/z.lua
for zsh:
fc -ln 0|grep -o "^cd [~/].*"|sed -e "s|cd ||" -e "s|~|$HOME|" -e 's|\\ | |' -e "s|/$||"|sort|uniq|while read -r d; do test -d "$d" && echo "$d|1|0"; done >> ~/z.lua
These two scripts above can be used for pre-warm .zlua
database.
Define a new zii
shell function to override z -I
:
function zii() {
local $dir="$(z -l "$@"|fzf --nth 2.. --reverse --inline-info --tac +s -e --height 35%)"
[ -n "$dir" ] && cd "$dir"
}
or just ignore the frecent
order:
function zii() {
local $dir="$(z -l -s "$@"|fzf ---reverse -e --height 35%)"
[ -n "$dir" ] && cd "$dir"
}