Mac下的效率工具autojump


(轉)

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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM