快速跳转工具--FASD 简单介绍

news/2024/5/15 1:43:06

前言

fasd是一个命令行加速工具。它提供了对文件和文件夹的快速访问。它和autojmp, z, v都很相近。它会记录你访问过的文件夹和文件, 然后你就可以通过简短的名字来直接访问它们。
fasd会对访问过的文件和文件夹按照使用频率排序,然后按照频率列出所有文件和文件夹

安装

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 entryfasd [-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" ]; thenfasd --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" ]; thenfasd --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.


http://lihuaxi.xjx100.cn/news/239449.html

相关文章

aws lambda_为什么我会自动删除所有旧的推文以及我用来执行此操作的AWS Lambda函数...

aws lambdaFrom now on, my tweets are ephemeral. Here’s why I’m deleting all my old tweets, and the AWS Lambda function I’m using to do all this for free.从现在开始&#xff0c;我的推文只是短暂的。 这就是为什么我删除所有旧的推文&#xff0c;以及免费使用所有…

vue-cli 使用小技巧

1.关闭烦人的eslint 语法检测&#xff0c;在 config 文件夹下 设置&#xff1a; // Use Eslint Loader? // If true, your code will be linted during bundling and // linting errors and warnings will be shown in the console. useEslint: false, //设置为false 2.引入sc…

exec不同文件l怎么汇总_ABAQUS常见问题汇总 - 2.0版.doc

您所在位置&#xff1a;网站首页 > 海量文档&nbsp>&nbsp计算机&nbsp>&nbspC/C资料ABAQUS常见问题汇总 - 2.0版.doc154页本文档一共被下载&#xff1a;次,您可全文免费在线阅读后下载本文档。下载提示1.本站不保证该用户上传的文档完整性&#xff0c…

html简单响应式滚动条置顶

简单响应式滚动条置顶 一般的&#xff0c;让页面出现滚动条的常见方法有&#xff1a; overflow:auto||overflow:scroll 或者overflow-x水平滚动条和overflow-y垂直滚动条那么现在要实现这样的一个效果&#xff1a; 直接在body中给一个header&#xff0c;后面一个Group盒子&…

我是如何在尼日利亚的沃里创立Google Developers Group GDG分会的,并达到了100位成员...

It only takes a spark to get a fire going, and soon all those around can warm up in its glowing. — Kurt Kaiser, Pass It On只需要一点火花就能使火熄灭&#xff0c;周围的所有人很快就会在炽热的火焰中升温。 — Kurt Kaiser&#xff0c;传递下去 I am convinced beyo…

node mysql 批量写入_请问如何使用node.js在MySQL中进行批量插入

catspeake我四处寻找关于批量插入对象的答案。Ragnar123的回答使我得出了这样的结论&#xff1a;function bulkInsert(connection, table, objectArray, callback) {let keys Object.keys(objectArray[0]);let values objectArray.map( obj > keys.map( key > obj[key]…

无法启动程序

莫名其妙的出现这个问题&#xff0c;非常困扰。 之前的程序都好好的&#xff0c;现在VS2010启动调试就报无法启动程序&#xff0c;完全没有办法工作了&#xff01; 真不知道什么原因&#xff01; 转载于:https://www.cnblogs.com/yhlx125/p/8056326.html

历史 history

题目描述 历史学家小&#xff21;正在研究一个奇怪的王国的历史。当前阶段的任务是研究该国的交通。 根据这个奇怪的王国的史书记载&#xff0c;史书开始记载前这个王国有 n 个城市&#xff08;城市从 0 开 始标号&#xff09; &#xff0c;但所有城市之间都没有道路相连。 …