demo1984s 的个人博客 demo1984s 的个人博客

记录精彩的程序人生

目录
iTerm2 + oh-my-zsh + Powerline + Iterm2-color-schemes 打造 Mac 下的超级终端
/      

iTerm2 + oh-my-zsh + Powerline + Iterm2-color-schemes 打造 Mac 下的超级终端

iTerm2 安装

到iTerm2官网 下载 ,解压后将 iTerm 移动到“应用程序”目录下即可,老规矩,第一打开使用右键“打开”。

oh-my-zsh 安装

根据官网 https://ohmyz.sh/#install 的说明,无论使用以下哪条命令均会报错

demo1984s@MacBook-Pro ~ % sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
curl: (7) Failed to connect to raw.github.com port 443: Connection refused
demo1984s@MacBook-Pro ~ %

猜测是被墙了的原因,将url替换成 https://github.com/ohmyzsh/ohmyzsh/blob/master/tools/install.sh

Looking for an existing zsh config...
Using the Oh My Zsh template file and adding it to ~/.zshrc.

         __                                     __
  ____  / /_     ____ ___  __  __   ____  _____/ /_
 / __ \/ __ \   / __ `__ \/ / / /  /_  / / ___/ __ \
/ /_/ / / / /  / / / / / / /_/ /    / /_(__  ) / / /
\____/_/ /_/  /_/ /_/ /_/\__, /    /___/____/_/ /_/
                        /____/                       ....is now installed!
Before you scream Oh My Zsh! please look over the ~/.zshrc file to select plugins, themes, and options.
• Follow us on Twitter: https://twitter.com/ohmyzsh
• Join our Discord server: https://discord.gg/ohmyzsh
• Get stickers, shirts, coffee mugs and other swag: https://shop.planetargon.com/collections/oh-my-zsh
➜  scripts

安装成功,敲入 exit 回车退出。

oh-my-zsh 主题设置

在目录 ~/.oh-my-zsh/themes/有不少主题可供选择,这里我们选择 agnoster.zsh-theme这个主题,注释掉默认主题“robbyrussell”,修改为“agnoster”

demo1984s@MacBook-Pro ~ % vi vi ~/.zshrc
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH

# Path to your oh-my-zsh installation.
export ZSH="/Users/tangjun/.oh-my-zsh"

# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
# ZSH_THEME="robbyrussell"
ZSH_THEME="agnoster"

Powerline 安装

官网安装说明: https://powerline.readthedocs.io/en/latest/installation.html ,执行安装命令的时候如果提示找不到 pip 则需要先安装 pip

demo1984s@MacBook-Pro  ~  pip install powerline-status
zsh: command not found: pip
 ✘ demo1984s@MacBook-Pro  ~  sudo easy_install pip
Searching for pip
Reading https://pypi.org/simple/pip/
Downloading https://files.pythonhosted.org/packages/54/eb/4a3642e971f404d69d4f6fa3885559d67562801b99d7592487f1ecc4e017/pip-20.3.3-py2.py3-none-any.whl#sha256=fab098c8a1758295dd9f57413c199f23571e8fde6cc39c22c78c961b4ac6286d

Best match: pip 20.3.3
Processing pip-20.3.3-py2.py3-none-any.whl
Installing pip-20.3.3-py2.py3-none-any.whl to /Library/Python/2.7/site-packages
Adding pip 20.3.3 to easy-install.pth file
Installing pip script to /usr/local/bin
Installing pip3.8 script to /usr/local/bin
Installing pip3 script to /usr/local/bin

Installed /Library/Python/2.7/site-packages/pip-20.3.3-py2.7.egg
Processing dependencies for pip
Finished processing dependencies for pip

再次安装 Powerline

bash
demo1984s@MacBook-Pro  ~  pip install powerline-status
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Defaulting to user installation because normal site-packages is not writeable 
Collecting powerline-status
  Downloading powerline-status-2.7.tar.gz (233 kB)
     |████████████████████████████████| 233 kB 74 kB/s
Building wheels for collected packages: powerline-status
  Building wheel for powerline-status (setup.py) ... done
  Created wheel for powerline-status: filename=powerline_status-2.7-py2-none-any.whl size=258577 sha256=7e50cb4e1b61f40ab6ba0d63c9b03a421098b6a7af2ade6b7aafb5709cd5337b
  Stored in directory: /Users/demo1984s/Library/Caches/pip/wheels/f7/f4/a2/46d8b8b875843df5ee1bdf538aae445f6c16cb354e05a1f4ae
Successfully built powerline-status
Installing collected packages: powerline-status
Successfully installed powerline-status-2.7

PowerFonts 安装

将字体库下载到本地

git clone https://github.com/powerline/fonts.git --depth=1 ~/.PowerFonts
Cloning into '~/.PowerFonts'...
remote: Enumerating objects: 310, done.
remote: Counting objects: 100% (310/310), done.
remote: Compressing objects: 100% (236/236), done.
remote: Total 310 (delta 75), reused 260 (delta 71), pack-reused 0
Receiving objects: 100% (310/310), 10.40 MiB | 25.00 KiB/s, done.
Resolving deltas: 100% (75/75), done.

iTerm2 -> Preferences -> Profiles -> Text 设置 FontMeslo LG M for Powerline

Iterm2-color-schemes 安装

官网 https://iterm2colorschemes.com 下载龟速,换一种方式,将 git 仓库拷贝到本地

git clone https://github.com/mbadolato/iTerm2-Color-Schemes ~/.iTerm2-Color-Schemes


标题:iTerm2 + oh-my-zsh + Powerline + Iterm2-color-schemes 打造 Mac 下的超级终端
作者:demo1984s
地址:http://www.demo1984s.com/articles/2020/12/28/1609090709028.html