https://swp-song.com/2017/08/20/Tools/OhMyZsh%E5%AE%89%E8%A3%85%E5%92%8C%E4%B8%BB%E9%A2%98%E9%85%8D%E7%BD%AE%E6%96%B9%E6%B3%95/html
Oh MyZsh 是什麼
Zsh 是什麼
- Zsh,它是一種命令行程序。咱們 Mac 系統上默認使用的 bash 命令行,而 Zsh 是另一種命令行環境。
- 咱們能夠在命令行中輸入 zsh –version 這個命令來查看咱們的電腦上是否安裝了 Zsh
- 終端查詢版本爲: zsh 5.2 (x86_64-apple-darwin16.0)
- 查看系統當前 shell,cat /etc/shells
- zsh 雖然功能強大,但剛上手配置比較麻煩。因此咱們用 Oh My Zsh 替換掉 Zsh。
安裝 Oh My Zsh 方法
- 能夠經過 curl 或 wget 兩種方式來安裝,用一條命令便可安裝。
1
|
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
|
1
|
sh -c "$(wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
xxxx% sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" Cloning Oh My Zsh... Cloning into '/Users/xxxx/.oh-my-zsh'... remote: Counting objects: 831, done. remote: Compressing objects: 100% (700/700), done. remote: Total 831 (delta 14), reused 775 (delta 10), pack-reused 0 Receiving objects: 100% (831/831), 567.67 KiB | 75.00 KiB/s, done. Resolving deltas: 100% (14/14), done. Looking for an existing zsh config... Found ~/.zshrc. Backing up to ~/.zshrc.pre-oh-my-zsh Using the Oh My Zsh template file and adding it to ~/.zshrc __ __ ____ / /_ ____ ___ __ __ ____ _____/ /_ / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ / /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / \____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ /____/ ....is now installed! Please look over the ~/.zshrc file to select plugins, themes, and options. p.s. Follow us at https://twitter.com/ohmyzsh. p.p.s. Get stickers and t-shirts at http://shop.planetargon.com.
|
設置主題
- 安裝完畢後,咱們就能夠使用了,先來簡單配置一下,Oh My Zsh 提供了不少主題風格,咱們能夠根據本身的喜愛,設置主題風格
- 終端輸入命令 open ~/.zshrc。
- 找到 ZSH_THEME ,ZSH_THEME=」robbyrussell」 ,robbyrussell ,是默認的主題,修改 ZSH_THEME=」 樣式名稱」
- 保存這個文件文件,從新打開終端。
- 步驟同上
- ZSH_THEME=」random」
- 每次打開終端主題是隨機的。
- 終端輸出:[oh-my-zsh] Random theme ‘/Users/xxxx/.oh-my-zsh/themes/zhann.zsh-theme’ loaded…,其中 zhann.zsh-theme 是主題的名稱, 有喜歡的童鞋能夠記錄保留
查看主題名稱
- Oh My Zsh 默認自帶了一些默認主題,存放在 ~/.oh-my-zsh/themes 目錄中。咱們能夠查看這些主題
- 終端輸入:
- ~/.oh-my-zsh/themes
- 查看:
- ls
- 查看結果:
卸載 Oh My Zsh
- 終端輸入 :
- uninstall_oh_my_zsh
- Are you sure you want to remove Oh My Zsh? [y/N] Y
- 終端提示信息:
1 2 3 4 5 6
|
Removing ~/.oh-my-zsh Looking for original zsh config... Found ~/.zshrc.pre-oh-my-zsh -- Restoring to ~/.zshrc Found ~/.zshrc -- Renaming to ~/.zshrc.omz-uninstalled-20170820200007 Your original zsh config was restored. Please restart your session. Thanks for trying out Oh My Zsh. It's been uninstalled.
|
Tips:
- Oh My Zsh 的自動更新提示誤觸關掉了解決辦法
- 打開終端輸入:
- upgrade_oh_my_zsh
- 若是不喜歡系統自帶終端,筆者推薦一個強大的終端 App。
- iTerm2,很是好用的一個終端軟件。
- iTerm2 下載地址