如何在 iTerm 中突出显示 IPv4 地址
一位朋友最近因为输入错误的 IP 地址而毁掉了一台服务器,我们想:如何才能在日常终端使用中使 IP 地址更清晰。
我们主要在 MacOS 上工作,使用 iTerm 并连接到远程服务器。
它是如何开始的
朋友:我今天不小心毁掉了一台服务器,因为我输错了 IP 地址。哎呀。
我:很抱歉您的损失...
朋友:是否有 iTerm2 设置可以在显示 IP 地址时始终突出显示/着色 IP 地址?
我: 我相信可以做到
A friend recently destroyed a server because he mistyped an IP address, and we thought: how could we make IP addresses clearer to the eye in our day to day Terminal use.
We mostly work from MacOS and use iTerm and connect to remote servers.
How it started
friend: I accidentally today destroyed a server because I mistyped an IP address. Oops.
me: sorry for your loss...
friend: Is there a iTerm2 setting to alwasy highlight/color IP addresses when they are displayed?
me: I believe it can be done
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在
iTerm
中导航至Preferences >简介>高级>触发器>编辑
并添加此正则表达式[0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3} )\.([0-9]{1,3})
然后选择操作
:突出显示文本
或突出显示行
。确保存在
enable
标志,并选择首选的Text
Background
颜色。结果:

in
iTerm
navigate toPreferences > Profiles > Advanced > Triggers > Edit
and add this regex[0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})
then select theAction
:Highlight Text
orHighlight Line
.Make sure the
enable
flag is present and chooseText
Background
colors as preferred.Result:
