How to input a hyphen - in the keyword ?
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.
How to integrate z.lua to ranger ?
Copy ranger_zlua.py to your ~/.config/ranger/plugins folder, and set environment variable in your shell rc:
The integration script provides a z command in ranger. It also tracks directories changes in ranger.
How to use z as cd ?
Paste this script in your .bashrc / .zshrc:
When you are using j xxx it will first try cd xxx and then z xxx if cd failed.
fz.sh for better completion
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:
If you are using zsh with antigen, initialize them like this:
How to import data from bash / zsh command history ?
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 z -I
Define a new zii shell function to override z -I:
or just ignore the frecent order: