将环境变量设置为 iTerm2 徽章

发布于 2025-01-15 10:39:37 字数 539 浏览 3 评论 0原文

我正在修改 iTerm2,试图实现以下目标:

  1. 切换到许多配置文件之一(例如工作和个人);
  2. 根据配置文件的使用情况设置/取消设置环境变量;
  3. 使徽章读取这些“流利”环境变量中的一个或多个。

目前,我正在通过在每个配置文件会话开始时设置环境变量来进行环境变量的“自动分配”:

设置->个人资料 ->一般->在开始处发送文本

export FOO="bar" && export FUZ="buz"

我认为有更好的方法来做到这一点,但这就是我到目前为止想到的。

我正在努力创建一个函数来读取这些环境变量并将它们的值分配给徽章内容。

我在网上读了很多东西,但似乎没什么用。

作为记录,我使用的是 zsh。

如果有配置 iTerm 经验丰富的人可以参与进来,我将不胜感激! :)

I'm tinkering with iTerm2, trying to achieve the following:

  1. switch to one of many profiles (e.g. work & personal);
  2. set/unset environment variables based on the usage of the profiles;
  3. make the badge read one or more of these "fluent" env vars.

Currently, I'm doing the "auto-assignment" of env vars by setting them at the start of each profile session:

Settings -> Profiles -> General -> Send text at start

export FOO="bar" && export FUZ="buz"

I assume there's a better way to do it but that's what I came up with so far.

What I'm struggling with is creating a function that would read these env vars and assign their values to the badge content.

I read a lot of stuff online but nothing seems to work.

For the record, I'm using zsh.

If someone more experienced with configuring iTerm could pitch in, I'd appreciate it! :)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文