标签:工具 主题
1、安装完成之后的样式
2、安装iTerm2
我以前就装过,所以这步骤略过。然后打开iTerm2,后面的操作全都在iterm2中完成。
3、安装oh-my-zsh
安装
curl方式安装
$ curl -L https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh | sh
安装失败,转而下载资源到本地进行安装。
下载到本地进行安装
$ cd ~
$ git clone https://github.com/robbyrussell/oh-my-zsh
$ cd ~/Downloads/ohmyzsh-master/tools
$ ./install.sh
- 安装时遇到的问题:
-
解决方案:
-
如果Safari地址栏中键入:
github.com:443
后进入的Github
是自己的仓库,那就退出登录。如果出现的是Github
的登录界面,那就登录Github
。我采用这个方法就解决了上述问题。我猜测是因为我没有给github设置SSH导致的。 -
终端
Clone
项目失败就在Safari
上刷新GitHub
的网页,如果网页能刷新再继续Clone。(WiFi刷新失败可尝试切换热点)
-
-
安装成功
安装成功的截图如下,这里折腾了好久,安装成功给我高兴坏了。
4、安装Powerline
powerline的作用
Powerline插件主要解决很多关于 oh my zsh 主题中的字体问题,比如有特殊的表情和符号的主体出现的乱码问题等。
安装pip
安装powerline之前需要安装pip。
方案一
$ sudo easy_install pip
-
出现错误
SyntaxError: invalid syntax
换个方法安装。
方案二
$ curl 'https://bootstrap.pypa.io/get-pip.py' > get-pip.py
$ sudo python3 get-pip.py
-
安装成功
Successfully installed pip-22.0.4
安装powerline-status
$ pip install powerline-status
-
安装成功
Successfully installed powerline-status-2.7
5、安装PowerFonts字体库
下载字体库
$ git clone https://github.com/powerline/fonts
安装字体库
进入fonts目录下,执行查看是否有install.sh
文件,如果有按照下面步骤安装Powerline的字体。
$ cd fonts/
$ ./install.sh
- 提示字体安装成功
Powerline fonts installed to /Users/teresa/Library/Fonts
设置iTerm 2的字体
进入iTerm 2的设置里找到Profile
中的Text
,设置Font
的字体为Powerline的字体即可。
步骤:iTerm2 -> Preferences -> Profiles -> Text
6、配置配色方案
下载
$ git clone https://github.com/altercation/solarized
导入iTerm2中
进入刚刚下载的文件的./iterm2-colors-solarized
下双击 Solarized Dark.itermcolors
和 Solarized Light.itermcolors
把两个配置文件导入到 iTerm2 里。
选择配色方案
进入iTerm 2的设置里找到Profile
中的Color
,在color presets
中选择Solarized Dark或者Solarized Light都可以。
步骤:iTerm2 -> Preferences -> Profiles -> Tolor
7、安装主题
下载主题
$ git clone https://github.com/fcamblor/oh-my-zsh-agnoster-fcamblor
安装agnoster主题
运行install文件,主题将被自动安装到~/.oh-my-zsh/themes
目录下:
$ cd ~/Downloads/oh-my-zsh-agnoster-fcamblor-master
$ ./install
-
安装时遇到的问题:
安装时提示
~/.oh-my-zsh/themes/
目录不存在,追溯后才发现是第一步zsh的安装就失败了。默默回去解决oh-my-zsh的安装问题,如果地基没打好,后面一定会困囿于各种奇怪的bug中。所以,一定要保证zsh以及它的配置的正确性哦~ -
配置
.zshrc
文件打开.zshrc文件
$ vi ~/.zshrc
配置
ZSH_THEME
=”agnoster“
,agnoster就是我们要用的主题。
ZSH_THEME=”agnoster“
安装powerlevel9k主题
-
下载
这里我用了github的镜像,不然打不开github。
$ git clone https://github.com/bhilburn/powerlevel9k.git ~/.oh-my-zsh/themes/powerlevel9k
-
配置
.zshrc
文件ZSH_THEME=”powerlevel9k/powerlevel9k“
安装powerlevel10k主题
-
下载&安装
国内直接使用gitee.com的镜像即可。
Just make sure to disable the current theme in your plugin manager.
指导手册上要求先废弃当前正在使用的主题,再安装
powerlevel10k
。官方安装指导如下:
git clone --depth=1 https://gitee.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
我依然和前面安装
powerlevel9k
的方式保持一致:git clone --depth=1 https://gitee.com/romkatv/powerlevel10k.git ~/.oh-my-zsh/themes/powerlevel10k
-
配置
.zshrc
文件ZSH_THEME=”powerlevel10k/powerlevel10k“
经过一系列自定义模板的选择后就可以进入iTerm2页面啦,可选择的模板特别多,我自己的定制模板深得我心,嘿嘿!
想了解更多使用方法,欢迎移步powerlevel10k官方。
8、设置高亮插件
下载插件
$ cd ~/.oh-my-zsh/custom/plugins
$ git clone git://github.com/zsh-users/zsh-syntax-highlighting.git
配置.zshrc
文件
在plugins
中配置高亮插件,zsh-syntax-highlighting
必须放在末尾。
plugins=(
git
zsh-syntax-highlighting
)
在.zshrc
文件最后一行增加配置
source ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
9、配置命令补全
下载插件
$ cd ~/.oh-my-zsh/custom/plugins/
$ git clone https://github.com/zsh-users/zsh-autosuggestions
在.zshrc
文件中配置命令补全插件
plugins=(
git
zsh-autosuggestions
zsh-syntax-highlighting
)
10、iTerm2-Color-Schemes主题集的运用
iTerm2不仅支持 macOS 原生 Terminal.app
,还支持了包括 iTerm2、Konsole、PuTTY、Xresources、Termite、XFCE 和 Terminator 等app的主题。
下载地址
$ git clone https://github.com/mbadolato/iTerm2-Color-Schemes
配色方案
schemes
文件夹下面所有配色方案都可以用于iTerm2中
screenshots
文件夹中有配色图片
适用于Mac 系统自带的Terminal.app的主题
terminal
文件夹下面主题适用于Mac 系统自带的Terminal.app
11、资料参考
本文参考以下众多网友的文章,感谢网友们的分享。