自动化您的iTerm布局和工作流

itomate的Python项目详细描述


iTomate公司

Automate your iTerm layouts and session setup

定义您的iTerm布局,以yaml文件的形式执行的命令,并运行一个命令让iTerm为您开始工作做好准备。在

要求

  • iTerm2 3.3版或更高版本
  • Python 3.5或更高版本

安装

确保运行的是python3.5或更高版本

pip install itomate

在iTerm首选项中的Enable Python API usage。在

^{pr2}$

示例

The layout, number of panes, tabs, titles and commands is configurable and is detailed below.

使用

打开iTerm并运行下面的命令

itomate -c config.yml

如果不提供-c标志,itomate将在当前目录中查找itomate.yml文件并使用它。在

以下是可用选项的列表

itomate [-c,--config <config-file>]# Sets up the iTerm session[-h,--help]# Shows the help screen[-v,--version]# Shows the installed itomate version[-n,--new]# Runs itomate in a new window

配置

用于设置会话的配置文件具有以下格式

version: "1.0"
profile: "My Profile"
tabs:
  window-1:
    root: "~/Documents/Projects/my_project"
    title: "Window 1"
    panes:
      - title: "Some Pane Title"
        position: "1/1"
        commands:
         - !ENV "db authenticate ${DB_PASSWORD}"
         - "second command"
        prompt: "populated command"
      - position: "1/2"
        focus: true
        badge: "Jobs"
      - position: "2/1"
      - position: "2/2"
  window-2:
    title: "Window 2"
    panes:
      - position: "1/1"
      - position: "1/2"
      - position: "2/1"

下面给出了上述每个配置对象的详细信息

KeyDescription
^{}Refers to the itomate configuration version. Should always be 1.
^{}Name of the profile you would like to use for all panes. If using ^{} argument to launch a new window, then window specific profile settings will be applied
^{}Windows or tabs in the iTerm window.
^{}Replace with the unique project id e.g. ^{}
^{}Root path for all panes within a tab
^{}Title to be shown in the title bar of the current tab
^{}Set the Badge Text of the pane
^{}Position of the pane in the window. It has the format of ^{} where ^{} refers to the column and ^{} refers to the row in the column. More on this later in the readme. ^{} is the only required key in a pane
^{}Pane to be in focus when itomate is finished. ^{}. There should only be one focus flag per Tab. If multiple are found, it will focus on the last pane evaluated.
^{}List of commands to execute in the current pane.
^{}A command which will remain populated in the prompt after all ^{}s have finished executing. The ^{} command itself is not executed automatically.

环境变量

操作系统环境变量可用于创建包含机密和变量的模板。这使得itomate文件可以安全地提交到版本控制中。注意在上面的配置示例中,使用环境变量的行以!ENV标记作为前缀,然后使用一个或多个环境变量 包装在${ }语法中。在

布局

每个窗格中的参数position决定每个窗口窗格的显示位置。位置值的格式如下

x / y – both x and y are required parameters

x: refers to the column in the window
y: refers to the row of the given column x

下面是一些不同窗格布局的示例

单窗格窗口

对于单个窗格,因为有一列一行,所以pane的位置应该是1/1

.------------------.
| 1/1              |
|                  |
|                  |
|                  |
|                  |
|                  |
|                  |
|                  |
|                  |
'------------------'

下面是配置的外观

version: "1.0"
tabs:
  some-project:
    title: "Some Project"
    panes:
      - title: "Single Pane"
        position: "1/1"
        commands:
          - "cd ~/Workspace/some-project"
          - "git pull origin master"
          - "yarn dev"

两个窗格垂直拆分布局

对于具有相等拆分的两个窗格,或者换句话说,每个窗格中有一行的两个列,其位置将为1/1,对于右侧的窗格,即第二列,2/1。在

.------------------.------------------.
| 1/1              | 2/1              |
|                  |                  |
|                  |                  |
|                  |                  |
|                  |                  |
|                  |                  |
|                  |                  |
|                  |                  |
|                  |                  |
'------------------'------------------'

下面是它在配置中的外观

version: "1.0"
tabs:
  some-project:
    root: "~/Workspace/some-project"
    title: "Some Project"
    panes:
      - title: "First Half"
        position: "1/1"    # <-- Notice the position
      - title: "Second Half"
        position: "2/1"    # <-- Notice the position

两列三窗格布局

下面的布局现在有两列。第一列只有一行,所以它的位置是1/1。对于第二列,我们有两个窗格,即两行;第二列中的第一个窗格将是2/1,第二个窗格将是2/2。在

.------------------.------------------.
| 1/1              | 2/1              |
|                  |                  |
|                  |                  |
|                  |                  |
|                  |------------------|
|                  | 2/2              |
|                  |                  |
|                  |                  |
|                  |                  |
'------------------'------------------'

其配置为:

version: "1.0"
tabs:
  some-project:
    root: "~/Workspace/dev-server"
    title: "Some Project"
    panes:
      - position: "1/1"    # <-- Notice the position
      - position: "2/1"    # <-- Notice the position
        commands:
          - "./run"
      - position: "2/2"    # <-- Notice the position
        commands:
          - "git standup"

注意,commands和{}是窗格中的可选参数。只需要position。在

两列四窗格布局

.------------------.------------------.
| 1/1              | 2/1              |
|                  |                  |
|                  |                  |
|                  |                  |
|------------------|                  |
| 1/2              |                  |
|                  |                  |
|                  |                  |
|------------------|                  |
| 1/3              |                  |
|                  |                  |
|                  |                  |
'------------------'------------------'

其配置为:

version: "1.0"
tabs:
  some-project:
    root: "~/Workspace/project"
    title: "Some Project"
    panes:
      - position: "1/1"    # <-- Notice the position
        commands:
          - "Make clean"
      - position: "1/2"    # <-- Notice the position
        commands:
          - "git standup"
      - position: "1/3"    # <-- Notice the position
        commands:
          - "git standup"
      - position: "2/1"    # <-- Notice the position
        commands:
          - "./run"

三列五窗格布局

.------------------.------------------.------------------.
| 1/1              | 2/1              | 3/1              |
|                  |                  |                  |
|                  |                  |                  |
|                  |                  |                  |
|                  |------------------|                  |
|                  | 2/2              |                  |
|                  |                  |                  |
|                  |                  |                  |
|                  |------------------|                  |
|                  | 2/3              |                  |
|                  |                  |                  |
|                  |                  |                  |
'------------------'------------------'------------------'

它的配置是

version: "1.0"
tabs:
  some-project:
    title: "Some Project"
    panes:
      - position: "1/1"    # <-- Notice the position
      - position: "2/1"    # <-- Notice the position
      - position: "2/2"    # <-- Notice the position
      - position: "2/3"    # <-- Notice the position
      - position: "3/1"    # <-- Notice the position

贡献者

特别感谢投稿人使iTomate成为可能

类似项目

有一个依赖于Applescript that has been deprecated by iTermitermocil,布局选项有限,而且由于AppleScript,它所能实现的功能非常有限。另一方面,iTomate使用iTerm的newly introduced Python API,具有灵活的布局支持,并且可以使用iTerm强大的API进行扩展。在

捐款

随时提交请求,制造问题,传播信息。在

许可证

麻省理工学院Kamran Ahmed

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
在Java中为上传的文件设计强制的文件夹结构   java我如何在下面的代码中解决这个>错误HTTP Status 404   java如何在方面字段Lucene上添加分页   java My 安卓应用程序在尝试10次后崩溃   java“找不到Spring NamespaceHandler”错误   连接到Dynamodb时发生java AWS lambda错误   过程的价值。JAVA中的exitValue()   eclipse vscode java正在尝试设置项目   JavaEclipse不再自动在javadocs中添加标签   java找不到LoggerFactory类   在Java中实现延迟   设置onClickListener时的java NullPointerException   用jsoup解析HTML:Android和Java的区别