ohmyzsh 基本配置和使用

终端也要精致一点,虽然iterms2我个人不是很喜欢,但是ohmyzsh的确是神器,所以还是来倒腾一下。

Change to zsh

https://ohmyz.sh/

mac下直接终端里用curl 安装就可以了。

1
$ sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

附:unix命令简介

sh命令是shell命令语言解释器,执行命令从标准输入读取或从一个文件中读取。通过用户输入命令,和内核进行沟通!Bourne Again Shell (即bash)是自由软件基金会(GNU)开发的一个Shell,它是Linux系统中一个默认的Shell。Bash不但与Bourne Shell兼容,还继承了C Shell、Korn Shell等优点。

更换主题

mac terminal默认的SF mono字体不支持一些VCS的branch符号,所以需要改用powerline字体。这里我使用了menlo for powerline

https://github.com/abertsch/Menlo-for-Powerline

最简单的还是直接下载zip包,然后解压双击安装,因为对macos的字体目录不熟悉。

image-20200712144759382

Customise colours in agnoster theme

直接在主题配置文件中修改就可以了

image-20200712143542274

找到git一栏

image-20200712144149071

可以在高亮的一行更改git branch的颜色。

另外,再找到dir一栏

image-20200712144100638

同样可以当前目录的颜色。

关于颜色,还有 一个发现:

Agnoster is designed for use specifically with the “Solarized” color palette, which defines a specific mapping of terminal palette ANSI colors to specific RGB values. And also recommends particular uses for those tones.

I.e., this is how you’re supposed to use them:

img

So, @sevaho and @mkamayd, you’re not really supposed to change your terminal color settings like that; you’re supposed to set your ANSI Color palette to Solarized and leave it there.

Within that Solarized recommendation, though, there’s leeway for which particular content/background/accent colors you’re using for what role. And maybe people want to customize that?

What @Billy- links to (the OMZ fork of Agnoster) is a reasonable way to do this, IMHO. It rearranges the roles of the Solarized colors, without changing the mapping of the palette colors to RGB values. This has the advantage that you could change the color role mapping in your ~/.zshrc config file, and then it would work in all terminals that you had configured to use Solarized.

apjanke commented on Jan 3

所以,agnoster的好像会自动适配,这个好像又是根据terminal 的solarized color palette 来的(就是太阳光配色),大概可以理解为几原色之类的东西,然后各种颜色映射都是通过这些solarized color来的,会设计和UI的可以看看,咱普通老百姓能稍微简单改改就不错了的说。