### Configure stack.wez with keybindings Source: https://context7.com/bad-noodles/stack.wez/llms.txt A comprehensive configuration example demonstrating how to apply plugin settings and define keybindings for spawning and navigating stacked panes. ```lua local wezterm = require("wezterm") local stack = wezterm.plugin.require("https://github.com/bad-noodles/stack.wez") local config = wezterm.config_builder() -- Configure stack.wez with all options stack.apply_to_config(config, { spawn_direction = "Bottom", spawn_domain = "CurrentPaneDomain", enrich_tab_title = true, }) -- Keybindings for stack management config.keys = { -- Stack management { key = "s", mods = "CMD|SHIFT", action = stack.action.SpawnPane }, { key = "k", mods = "CMD|SHIFT", action = stack.action.ActivatePaneRelative(-1) }, { key = "j", mods = "CMD|SHIFT", action = stack.action.ActivatePaneRelative(1) }, -- Close pane (built-in WezTerm action) { key = "w", mods = "CMD", action = wezterm.action.CloseCurrentPane({ confirm = true }) }, -- Toggle zoom to temporarily see all panes { key = "z", mods = "CMD|SHIFT", action = wezterm.action.TogglePaneZoomState }, } return config ``` -------------------------------- ### Install and Configure WezTerm Stack Plugin Source: https://github.com/bad-noodles/stack.wez/blob/main/README.md This Lua code snippet demonstrates how to install the stack.wez plugin and apply its configurations, including setting up custom keybindings for pane management. It requires the WezTerm Lua API. ```lua local wezterm = require("wezterm") local stack = wezterm.plugin.require("https://github.com/bad-noodles/stack.wez") local config = wezterm.config_builder() stack.apply_to_config(config) -- stack.wez does not set up any keybindings by default, so you need to add your own config.keys = { { key = "s", mods = "CMD|SHIFT", action = stack.action.SpawnPane }, { key = "k", mods = "CMD|SHIFT", action = stack.action.ActivatePaneRelative(-1) }, { key = "j", mods = "CMD|SHIFT", action = stack.action.ActivatePaneRelative(1) }, -- For closing panes, use the built-in WezTerm action { key = "w", mods = "CMD", action = wezterm.action.CloseCurrentPane({ confirm = true }) }, } -- or config.keys = { { key = "s", mods = "CTRL|SHIFT", action = stack.action.SpawnPane }, { key = "k", mods = "CTRL|SHIFT", action = stack.action.ActivatePaneRelative(-1) }, { key = "j", mods = "CTRL|SHIFT", action = stack.action.ActivatePaneRelative(1) }, { key = "w", mods = "CTRL", action = wezterm.action.CloseCurrentPane({ confirm = true }) }, } return config ``` -------------------------------- ### Configure Stack.wez Plugin Source: https://context7.com/bad-noodles/stack.wez/llms.txt Basic setup for integrating the Stack.wez plugin into a WezTerm configuration file. This includes defining keybindings for spawning and navigating stacked panes. ```lua local wezterm = require("wezterm") local stack = wezterm.plugin.require("https://github.com/bad-noodles/stack.wez") local config = wezterm.config_builder() -- Apply the plugin to your config stack.apply_to_config(config) -- Configure your keybindings config.keys = { { key = "s", mods = "CMD|SHIFT", action = stack.action.SpawnPane }, { key = "k", mods = "CMD|SHIFT", action = stack.action.ActivatePaneRelative(-1) }, { key = "j", mods = "CMD|SHIFT", action = stack.action.ActivatePaneRelative(1) }, { key = "w", mods = "CMD", action = wezterm.action.CloseCurrentPane({ confirm = true }) }, } return config ``` -------------------------------- ### Initialize Plugin with Custom Options Source: https://context7.com/bad-noodles/stack.wez/llms.txt Demonstrates how to initialize the plugin with custom settings such as spawn direction, domain, and tab title enrichment. ```lua local wezterm = require("wezterm") local stack = wezterm.plugin.require("https://github.com/bad-noodles/stack.wez") local config = wezterm.config_builder() -- Apply with custom options stack.apply_to_config(config, { spawn_direction = "Bottom", -- "Top", "Bottom", "Left", or "Right" spawn_domain = "CurrentPaneDomain", -- Domain for new panes enrich_tab_title = true -- Show stack position in tab title (e.g., "zsh [1/3]") }) return config ``` -------------------------------- ### Spawn Stacked Panes Source: https://context7.com/bad-noodles/stack.wez/llms.txt Configures keybindings to trigger the creation of a new stacked pane using the stack.action.SpawnPane action. ```lua local wezterm = require("wezterm") local stack = wezterm.plugin.require("https://github.com/bad-noodles/stack.wez") local config = wezterm.config_builder() stack.apply_to_config(config) config.keys = { -- Spawn a new stacked pane with Cmd+Shift+S { key = "s", mods = "CMD|SHIFT", action = stack.action.SpawnPane }, -- Alternative: Ctrl+Shift+S for Linux/Windows { key = "s", mods = "CTRL|SHIFT", action = stack.action.SpawnPane }, } return config ``` -------------------------------- ### Navigate Stacked Panes Source: https://context7.com/bad-noodles/stack.wez/llms.txt Configures keybindings to cycle through stacked panes using the stack.action.ActivatePaneRelative action with directional offsets. ```lua local wezterm = require("wezterm") local stack = wezterm.plugin.require("https://github.com/bad-noodles/stack.wez") local config = wezterm.config_builder() stack.apply_to_config(config) config.keys = { -- Navigate to previous pane in stack (Vim-style k for up) { key = "k", mods = "CMD|SHIFT", action = stack.action.ActivatePaneRelative(-1) }, -- Navigate to next pane in stack (Vim-style j for down) { key = "j", mods = "CMD|SHIFT", action = stack.action.ActivatePaneRelative(1) }, -- Alternative arrow key navigation { key = "UpArrow", mods = "CTRL|SHIFT", action = stack.action.ActivatePaneRelative(-1) }, { key = "DownArrow", mods = "CTRL|SHIFT", action = stack.action.ActivatePaneRelative(1) }, } return config ``` -------------------------------- ### Customize WezTerm Stack Plugin Options Source: https://github.com/bad-noodles/stack.wez/blob/main/README.md This Lua snippet shows how to customize the behavior of the stack.wez plugin by passing an options table to the `apply_to_config` function. Options include `spawn_direction`, `spawn_domain`, and `enrich_tab_title`. ```lua stack.apply_to_config(config, { spawn_direction = "Bottom", -- "Top", "Bottom", "Left", or "Right" spawn_domain = "CurrentPaneDomain", enrich_tab_title = true -- Show stack position in tab title }) ``` -------------------------------- ### Retrieve stack information with stack_info Source: https://context7.com/bad-noodles/stack.wez/llms.txt Retrieves the current stack state for a specific tab, returning a table with index and count if in stacked mode. This is useful for building custom tab title formatters that display pane position. ```lua local wezterm = require("wezterm") local stack = wezterm.plugin.require("https://github.com/bad-noodles/stack.wez") local config = wezterm.config_builder() -- Disable built-in tab title enrichment to use custom formatter stack.apply_to_config(config, { enrich_tab_title = false }) -- Create a custom tab title formatter with emoji indicators wezterm.on("format-tab-title", function(tab_info) local stack_info = stack.stack_info(tab_info.tab_id) local title = tab_info.active_pane.title if stack_info then -- Returns: { index = 2, count = 3 } when on pane 2 of 3 return string.format("%s 📚 %d/%d", title, stack_info.index, stack_info.count) end -- Not in stacked mode, return plain title return title end) return config ``` -------------------------------- ### Format tab titles with tab_title Source: https://context7.com/bad-noodles/stack.wez/llms.txt Generates a formatted string containing the tab index and title. This utility simplifies the creation of custom tab formatters by handling the title logic internally. ```lua local wezterm = require("wezterm") local stack = wezterm.plugin.require("https://github.com/bad-noodles/stack.wez") local config = wezterm.config_builder() stack.apply_to_config(config, { enrich_tab_title = false }) -- Custom formatter combining tab_title with stack info wezterm.on("format-tab-title", function(tab_info) local title = stack.tab_title(tab_info) -- Returns "1: zsh" or "2: Custom Title" local info = stack.stack_info(tab_info.tab_id) if info then return title .. " [" .. info.index .. "/" .. info.count .. "]" end return title end) return config ``` -------------------------------- ### Custom WezTerm Tab Title Formatter with Stack Plugin Source: https://github.com/bad-noodles/stack.wez/blob/main/README.md This Lua code demonstrates how to create a custom tab title formatter for WezTerm using the stack.wez plugin. It disables the built-in enrichment and uses the `stack.stack_info` function to display the pane's position within the stack. ```lua -- Disable the built-in tab title enrichment stack.apply_to_config(config, { enrich_tab_title = false }) -- Create your own custom formatter wezterm.on("format-tab-title", function(tab_info) local stack_info = stack.stack_info(tab_info.tab_id) if stack_info then return string.format("%s 📚 %d/%d", tab_info.tab_title, stack_info.index, stack_info.count ) end return tab_info.tab_title end) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.