(轉)
IDE 用起來總是得不到滿足,Mac 適合搞開發,我也十分喜歡 Mac 系統,當然可以說喜歡 Unix/Linux 系統。今天在 .zshrc
文件中添加了這么幾行快捷命令:
alias gow = "cd ~/barretlee/work"
alias gotb = "cd ~/barretlee/work/tb"
alias gotbn = "cd ~/barretlee/work/tb/node"
|
寫完之后我立馬把這幾行命令刪掉了,這種方式似乎有點二。網上搜羅了下,找到了一個挺不錯的工具 - autojump。
Autojump 自己是這么描述的:
autojump is a faster way to navigate your filesystem. It works by maintaining a database of the directories you use the most from the command line.
通過 history
命令你可以找到最近用過的命令,比如
history | grep "git clone"
|
通過上述命令就能找到近期 clone 了哪些庫,省卻了寫一堆代碼的功夫。autojump 就是通過記錄你在 history 中的行為把你訪問過的文件夾路徑都 cache 下來,當你進行如下操作時:
autojump node
|
他會直接跳到之前訪問的 ~/barretlee/work/tb/node
目錄下。他還有一個快捷方式:
j node
|
我很喜歡這個小工具,讓我游盪於文件夾之間不費吹灰之力。
安裝:
- 建議安裝 zsh
- 建議安裝 homebrew
brew install autojump
-
在
.zshrc
中找到plugins=
,在后面添加plugins=(git autojump) -
然后繼續在上述文件中添加
[[ -s $(brew --prefix)/etc/profile.d/autojump.sh ]] && . $(brew --prefix)/etc/profile.d/autojump.sh -
source ~/.zshrc