实现方式很简单分为三步:需要到github上面clone一个插件https://github.com/rupa/z.git
1、打开如下图所示:复制协议

-
在Git Bash 上执行命令 git clone https://github.com/rupa/z.git 将文件clone 到本地
-
查询该插件安装的根目录
image.png
-执行命令打开bashrc 开始编辑

2、在文件里写入(注意这是我自己的安装目录)
注意格式 前面的 .
和空格别忘了,写好保存 再回到 Git bash
. ~/repos/z/z.sh
alias j='z'

3、重启即可大功告成
重启 Git Bash
你去过的所有目录都会被记录了!使用 j XXX 就可以快速到达之前去过的目录了!
使用 j 可以查看所有去过的目录
注意,~/repos/z/z.sh 不能删除,删除了就不能用了。

使用起来十分方便快捷。

特别鸣谢饥人谷芳芳老师
网友评论