iTerm 2档案 [英] iTerm 2 profiles

查看:59
本文介绍了iTerm 2档案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近切换到了iTerm2并喜欢它.我想知道是否有一种方法可以使用配置文件来对应您所使用的环境/特定计算机.

I have recently switched over to iTerm2 and love it. I am wondering though if there is a way to use profiles to correspond to what environment/specific machine you are on.

假设我在Mac上的一个窗口中执行任务,则默认情况下显示配置文件,但如果将ssh放入计算机中(例如dev0),iTerm上的配置文件将更新为配置文件dev0.一旦完成dev0并调用exit,配置文件将再次切换为默认设置.

Say if I am doing tasks in one window on my mac the profile is displayed as default, but if I ssh into a machine (lets say dev0), the profile on iTerm will update to profile dev0. Once I've finished with dev0 and call exit, the profile will switch to default again.

我知道一种解决方法是,每当我要ssh进入另一台机器并有一种区分方法时,都打开一个特定的配置文件,但是如果连接关闭,则需要您根据文本而不是说背景来进行注意.窗口.

I realize one work around is to open up a specific profile whenever I want to ssh into another machine and have a way to distinguish, but if the connection is closed it requires you to notice based off text rather than say the background of the window.

这可能吗?如果没有,如何添加此功能,有什么办法可以我做出贡献?

Is this possible? If not how can this feature be added, and is there a way I can contribute?

推荐答案

iTerm2支持自定义转义代码,该代码可随时更改配置文件.将其放在您的.bashrc或.bash_profile中.

iTerm2 supports a custom escape code that changes the profile on the fly. Put it in your .bashrc or .bash_profile.

<esc>]50;SetProfile=X^G

其中X是配置文件.例如,要将配置文件更改为一个名为"Foo"的配置文件,请使用以下shell脚本:

where X is the profile. For instance, to change the profile to one called "Foo", us this shell script:

#!/bin/bash
echo -e "\033]50;SetProfile=Foo\a"

要在注销时将其更改回原来的位置,请在〜/.bash_logout中输入代码以将配置文件更改回默认值.

To change it back when you log out, put code to change the profile back to default in ~/.bash_logout.

这篇关于iTerm 2档案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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