iTerm 2 profiles

前端 未结 7 1721
庸人自扰
庸人自扰 2021-01-29 23:10

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.

7条回答
  •  逝去的感伤
    2021-01-29 23:36

    In my case, I need to combine Yohaï Berreby's answer with my hosts' setting to implement this feature.

    1. In Automatic Profile Switching, click '+' and add the hostname of your local machine. The hostname is the one you get when running echo $HOST on the target machine. It is not always the one you see in your prompt.

    My staging server doesn't set $HOST and host name is :

    [devel@alveo-staging ~]$ hostname
    alveo-staging
    

    But I can't set the rule with hostname as alveo-staging. Because in fact alveo-staging is just an alias of the real hostname (alveo-staging.xxx), which can be set in /etc/hosts.

    So the quick solution to this is to use * wildcards, to set the rule as *staging*.

    Then it works.

提交回复
热议问题