跳至正文

终端 > 窗口与标签页

启动配置 (旧版)

在 ChatGPT 中打开 ↗
向 ChatGPT 提问关于此页面的内容
在 Claude 中打开 ↗
向 Claude 提问关于此页面的内容
已复制!

启动配置(旧版)允许您保存窗口、标签页和窗格的配置。对于新的设置,请改用“标签页配置 (Tab Configs)”。

借助启动配置,您可以在应用内进行保存,或者通过添加 YAML 文件来进行配置。

  1. 设置好您想要保存的窗口、标签页和窗格配置。
  2. 打开 命令面板,然后输入 Save New Launch Configuration
  3. 为配置文件命名。名称字段不能为空。
  4. 点击“Save configuration”(保存配置)按钮。
  • 命令面板 输入 Launch Configuration 以打开并选择启动配置。
  • 右键点击新的“标签页 +”按钮,打开菜单并选择已保存的启动配置。
  • 从 macOS 菜单栏选择 File(文件) > Launch Configurations(启动配置),您可以在其中搜索并打开已保存的启动配置。
    • 使用 macOS 上的 CMD-ENTER,可以将单窗口启动配置加载到当前激活的窗口中。

所有启动配置 YAML 文件都存储在以下位置

终端窗口
$HOME/.warp/launch_configurations/

示例配置,展示了启动配置文件中窗口的结构。

# Warp Launch Configuration
#
# This configuration has two windows,
# each with one tab in different starting directories.
---
name: Example Windows
windows:
- tabs:
- title: Documents
layout:
cwd: /Users/warp-user/Documents
color: blue
- tabs:
- title: Warp User
layout:
cwd: /Users/warp-user
color: green

下面是一个示例配置,展示了启动配置文件中标签页的结构。

  • 使用 title 字段设置自定义标签页名称
  • 使用 color 字段设置标签页颜色
    • 我们目前支持使用终端颜色(ANSI 颜色)

      Red(红) | Green(绿) | Yellow(黄) | Blue(蓝) | Magenta(洋红) | Cyan(青)

      实际颜色值将自动从您的 Warp 主题中获取

# Warp Launch Configuration
#
# This configuration has two tabs in the same window.
---
name: Example Tabs
windows:
- tabs:
- title: Documents
layout:
cwd: /Users/warp-user/Documents
color: blue
- title: Warp User
layout:
cwd: /Users/warp-user
color: green

启动配置支持在每个标签页中设置拆分窗格。请注意,Warp 也支持在启动配置文件中嵌套拆分窗格。

# Warp Launch Configuration
#
# This configuration is two windows, each with split panes.
# The first window contains a vertically split tab with two panes.
# The second window contains a horizontally split tab,
# with a vertically split tab on the right.
---
name: Example Panes
windows:
- tabs:
- title: Downloads and Warp User
layout:
split_direction: vertical
panes:
- cwd: /Users/warp-user/Downloads
- cwd: /Users/warp-user
color: blue
- tabs:
- title: Desktop, Documents, and Warp User
layout:
split_direction: horizontal
panes:
- cwd: /Users/warp-user/Desktop
- split_direction: vertical
panes:
- cwd: /Users/warp-user/Documents
- cwd: /Users/warp-user
color: green

示例配置展示了如何激活窗口和标签页,并聚焦于特定会话。

  • 使用 active_window_indexactive_tab_index 字段来设置激活的窗口和标签页。
  • 使用 is_focused 字段设置每个标签页中聚焦的窗格。
# Warp Launch Configuration
#
# This configurations has two tabs, with the second tab active.
# Two vertical split panes in the first tab and the top pane focused.
# Two horizontal split panes in the second tab and the right pane focused.
---
name: Example Active and Focus
active_window_index: 0
windows:
- active_tab_index: 1
tabs:
- title: Tab 1
layout:
split_direction: vertical
panes:
- cwd: /Users/warp-user/Documents
is_focused: true
- cwd: /Users/warp-user/Documents/Projects
- title: Tab 2
layout:
split_direction: horizontal
panes:
- cwd: /Users/warp-user/Downloads
- cwd: /Users/warp-user
is_focused: true

使用 commands 字段来定义运行启动配置时要执行的一组命令。

# Warp Launch Configuration
#
# This configuration has two windows,
# the first window executes two commands on start,
# the second window has a split pane that executes a command on start.
---
name: Example Commands
windows:
- tabs:
- title: Documents
layout:
cwd: /Users/warp-user/Documents
commands:
- exec: ls
- exec: code .
color: blue
- tabs:
- title: Downloads
layout:
split_direction: vertical
panes:
- cwd: /Users/warp-user/Downloads
commands:
- exec: curl http://example.com -o my.file
- exec: cp my.file my.file2
- cwd: /Users/warp-user
commands:
- exec: ssh user@remote.server.com
color: green