item2 + oh my zsh 安装

9次阅读

共计 1366 个字符,预计需要花费 4 分钟才能阅读完成。

安装 iTerm2
iTerm2 官方下载地址,直接下载安装即可。

安装 oh my zsh
1. 通过 cat /etc/shells 命令可以查看当前系统可以使用哪些 shell;
# List of acceptable shells for chpass(1).
# Ftpd will not allow users to connect who are not using
# one of these shells.
/bin/bash
/bin/csh
/bin/ksh
/bin/sh
/bin/tcsh
/bin/zsh
2. 通过 echo $SHELL 命令可以查看我们当前正在使用的 shell;
# Mac 系统中默认的 shell 为 bash shell
/bin/bash
3. 如果当前的 shell 不是 zsh,我们可以通过 chsh -s /bin/zsh 命令可以将 shell 切换为 shell 之 zsh,终端重启之后即可生效。
4. 将 shell 切换为 zsh 之后,我们就可以安装 Oh My ZSH 了官方推荐的安装方法为:
sh -c “$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)”
5. 安装成功后,如下图:

oh my zsh 默认安装在:~/.oh-my-zsh 目录下,配置文件默认为:~/.zshrc。

设置快捷命令
输入 vim ~/.zshrc,修改 zsh 的配置文件,在文件的最后 alias 中,添加 alias 快捷命令名 =” 实际命令 ” 即可。

配置完成后需要执行一下命令,然后重启 item2:
source ~/.zshrc
之后如果你在 item2 中再输入 nginxconfig 这个命令就可以快捷使用 vim 打开 nginx 的配置文件了(相当于执行了 vim /usr/local/etc/nginx/nginx.conf)

配置 themes
Oh My Zsh 提供的所有主题在线预览:https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
大部分主题可以通过以下操作直接更改:1. 进入配置文件
vi ~/.zshrc
2. 将 ZSH_THEME 设置成你想要设置的 themes,可从上面的 themes 列表中选择
ZSH_THEME=”agnoster”
3. 更新配置
source ~/.zshrc

配置特殊的 agnoster 主题

agnoster 主题能否设置成功,还依赖于以下东西:
Solarized Dark 配色方案
下载完成之后解压,在 iTerm2 的 Preferences——Profiles——colors——Load Presets 中即可设置终端配色为 Solarized Dark;

特殊字体安装
下载完成之后解压,执行其中的 install.sh 文件
# clone
git clone https://github.com/powerline/fonts.git –depth=1
# install
cd fonts
./install.sh
# clean-up a bit
cd ..
rm -rf fonts

在 iTerm2 的 Preferences——Profiles——Text 中同时将 Regular Font 和 Non—ASCII Font 设置为 Meslo LG M DZ Regular for Powerline 或者 Meslo LG M DZ for Powerline 即可;

正文完
 0