mac添加oh my zsh


Mac 終端 oh-my-zsh 配置

 

Mac 終端默認 shell 為 bash。
zsh 可能是目前最好的 shell ,至於好在哪里可自行百度。
本文主要介紹使用 zsh 以及 oh-my-zsh 的配置。

使用 zsh

查看當前使用的 shell

echo $SHELL

/bin/bash

查看安裝的 shell

cat /etc/shells

/bin/bash
/bin/csh
/bin/ksh
/bin/sh
/bin/tcsh
/bin/zsh

使用 brew 更新 zsh

brew install zsh

==> Downloading https://homebrew.bintray.com/bottles/zsh-5.5.1.high_sierra.bottle.tar.gz ######################################################################## 100.0% ==> Pouring zsh-5.5.1.high_sierra.bottle.tar.gz /usr/local/Cellar/zsh/5.5.1: 1,444 files, 12MB 

切換為 zsh

chsh -s /bin/zsh

重啟終端即可使用 zsh

oh-my-zsh

安裝

執行從 oh-my-zsh 的 GitHub 下載的安裝腳本

sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

  ____  / /_     ____ ___  __  __   ____  _____/ /_  
 / __ \/ __ \   / __ `__ \/ / / /  /_  / / ___/ __ \ 
/ /_/ / / / /  / / / / / / /_/ /    / /_(__  ) / / / 
\____/_/ /_/  /_/ /_/ /_/\__, /    /___/____/_/ /_/  
                        /____/                       ....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 配置文件

vim ~/.zshrc
 

配置項 ZSH_THEME 即為 oh-my-zsh 的主題配置,oh-my-zsh 的 GitHub Wiki 頁面提供了 主題列表
當設置為 ZSH_THEME=random 時,每次打開終端都會使用一種隨機的主題。

更新配置

source ~/.zshrc

自動補全插件

下載 incr 自動補全插件 http://mimosa-pudica.net/src/incr-0.2.zsh
將插件放在 oh-my-zsh 自定義插件目錄中

 

 

打開 oh-my-zsh 配置文件

vim ~/.zshrc
 

 plugins 中添加 incr
在配置文件結束添加:

source $ZSH/custom/plugins/incr/incr*.zsh

更新配置

source ~/.zshrc

最終效果如官網所示:

 

 

Homebrew:
https://brew.sh/index_zh-cn
https://github.com/Homebrew/brew
oh-my-zsh:
https://ohmyz.sh/
https://github.com/robbyrussell/oh-my-zsh
incr:
http://mimosa-pudica.net/zsh-incremental.html


免責聲明!

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



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