@[email protected] has produced a fish plugin for creating #wezterm tabs and splits... by prompting GPT4.

The transcript from the prompting session can be found at https://sharegpt.com/c/UFBSNrN and it's pretty interesting to see the the "collaborative" process and refinement of the solution.

The fish plugin itself can be found at https://github.com/Yukaii/wezl.fish

Create WezTerm Layout. - A ShareGPT conversation

This is a conversation between a human and a GPT-3 chatbot. The human first asks: Below is the help of wezterm cli spaw command. It can spawn new window or pane by specifying options. I want you to implement a fish shell function named `wezc` that create default layout for me. It should create: 1. 5 tabs (Each tab can be create with wezterm cli spawn —window-id WINDOW_ID) 2. The second tab(pane) Should be splitted with golden ratio layout, one pane by left, two horiziontally pane by right 3. The first wezterm cli spawn —new-window —cwd takes a argument cwd that can be used in all window/tabs 4. wezterm cli spawn —new-window return a window id that can be used for spawning others panes --- Usage: wezterm cli spawn [OPTIONS] [PROG]... Arguments: [PROG]... Instead of executing your shell, run PROG. For example: `wezterm cli spawn -- bash -l` will spawn bash as if it were a login shell Options: --pane-id Specify the current pane. The default is to use the current pane based on the environment variable WEZTERM_PANE. The pane is used to determine the current domain and window --domain-name --window-id Specify the window into which to spawn a tab. If omitted, the window associated with the current pane is used. Cannot be used with `--workspace` or `--new-window` --new-window Spawn into a new window, rather than a new tab --cwd Specify the current working directory for the initially spawned program --workspace When creating a new window, override the default workspace name with the provided name. The default name is "default". Requires `--new-window` -h, --help Print help. The GPT-3 chatbot then responds: <div><p>To create the desired layout, you can create a fish shell function named <code>wezc</code> as follows:</p><pre><div class="bg-black rounded-md mb-4"><div class="flex items-center relative text-gray-200 bg-gray-800 px-4 py-2 text-xs font-sans"><span>fish</span><svg stroke="currentColor" fill="none" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="h-4 w-4" height="1em" width="1em" xmlns="http://www.w3.org/2000/svg"></svg>Copy code</div><div><code class="!whitespace-pre hljs language-fish">function wezc set cwd $argv[1] # Create the first tab with the specified current working directory set window_id (wezterm cli spawn --new-window --cwd $cwd) # Create 4 additional tabs in the same window for i in (seq 2 5) wezterm cli spawn --window-id $window_id --cwd $cwd end # Split the second tab with the golden ratio layout set golden_ratio 0.618033988749895 set pane_id (wezterm cli split --window-id $window_id --pane 1 --orientation Vertical --cwd $cwd) wezterm cli split --pane-id $pane_id --orientation Horizontal --fraction $golden_ratio --cwd $cwd end </code></div></div></pre><p>Now you can use <code>wezc <CWD></code> to create the desired layout in WezTerm. Just replace <code><CWD></code> with the desired current working directory for all the panes.</p></div>