前言
安装
git clone https://github.com/clvv/fasd.git cd fasd make install
讯享网
然后把下面语句放到你的.bashrc或.zshrc下
讯享网eval "$(fasd --init auto)"
命令
fasd [options] [query ...] [f|a|s|d|z] [opions] [query ...] options: -s list paths with scores -l list paths without scores -i interactive mode -e <cmd> set command to execute on the result file -b <name> only use <name> backend -B <name> add additional backend <name> -a match files and directories -d match directories only -f match files only -r match by rank only -t match by recent access only -R reverse listing order -h show a brief help message -[0-9] select the nth entry fasd [-A|-D] [paths ...] -A add paths -D delete paths
比如输入fasd -R的返回结果是
讯享网$ fasd -R 75.3984 /home/harriszh/dw/dev/dw_fp_mult/src 63.423 /home/harriszh/dw/work_version/sim_ver.2015 44.8636 /home/harriszh/avip/axi3_master_tlm_slave_tlm 43.8288 /home/harriszh/.fzf 37.4402 /home/harriszh/.zshrc 35.572 /home/harriszh/dw/dev/dw_fp_mult 26.0366 /home/harriszh/.fzf/shell 25.6842 /home/harriszh/.vim/bundle ...
配置
ZSH:
# fasd fasd_cache="$HOME/.fasd-init-zsh" if [ "$(command -v fasd)" -nt "$fasd_cache" -o ! -s "$fasd_cache" ]; then fasd --init posix-alias zsh-hook zsh-ccomp zsh-ccomp-install >| "$fasd_cache" fi source "$fasd_cache" unset fasd_cache
BASH:
讯享网fasd_cache="$HOME/.fasd-init-bash" if [ "$(command -v fasd)" -nt "$fasd_cache" -o ! -s "$fasd_cache" ]; then fasd --init posix-alias bash-hook bash-ccomp bash-ccomp-install >| "$fasd_cache" fi source "$fasd_cache" unset fasd_cache
aliases
带自以下aliases
alias a='fasd -a' # any
alias s='fasd -si' # show / search / select
alias d='fasd -d' # directory
alias f='fasd -f' # file
alias sd='fasd -sid' # interactive directory selection
alias sf='fasd -sif' # interactive file selection
alias z='fasd_cd -d' # cd, same functionality as j in autojump
alias zz='fasd_cd -d -i' # cd with interactive selection
建议把z和zz注释掉, 因为后面会用fzf+fasd来实现
使用
使用如下:
# list recent files matching foo f foo # list recent files and directories matching foo and bar a foo bar # list recent files that ends in js f js$ # run vim on the most frecent file matching foo f -e vim foo # run mplayer on the most frecent file matching bar mplayer `f bar` # cd into the most frecent directory matching foo z foo # interact open `sf pdf`
问题
在zsh里配合fzf使用时经常会出现这个错误
fasd_cd:1: maximum nested function level reached
这时应该检查一下fasd有没有被其它脚本alias
后言
fasd单独使用也非常强大,但配合fzf会再强大,所以fasd只是三剑客之一,另外两剑客是riggrep和fzf.

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容,请联系我们,一经查实,本站将立刻删除。
如需转载请保留出处:https://51itzy.com/kjqy/55896.html