在iterm2中更改用户名,主机名和路径颜色 [英] Changing username, hostname, and path color in iterm2

查看:1543
本文介绍了在iterm2中更改用户名,主机名和路径颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在iTerm2中更改用户名,主机名和路径颜色?我正在使用内置的Solarized配色方案.

How can I change the username, hostname, and path color in iTerm2? I'm using the built-in Solarized colorscheme.

在Ubuntu中,相同的内置colorcheme突出显示为:

In Ubuntu, the same built-in colorscheme is highlighted like:

在iTerm2中:

In iTerm2:

当前的iTerm2设置:

Current iTerm2 settings:

我一直在玩这些设置,但是无法正常使用.我也浏览了许多链接,但这些设置也无法使用.

I've been playing around the settings but can't get it to work. I've also gone through numerous links, but those also settings don't work.

我在macOS 10.15.4上

I'm on macOS 10.15.4

推荐答案

$PS1的默认值:

%n@%m %1~ %#

此链接(在提示示例部分中)的$PS1的更新值. :

Updated value of $PS1 from this link (in the Prompt Example section):

%(?.%F{green}.%F{green})%n@%m %1~ %# %f

在我的.zshrc中添加了以下内容:

Added the below in my .zshrc:

export PS1='%(?.%F{green}.%F{green})%n@%m %1~ %# %f'

这篇关于在iterm2中更改用户名,主机名和路径颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆