### Apply Keybinding to WezTerm Config (Lua) Source: https://github.com/aureolebigben/wezterm-cmd-sender/blob/main/README.md This code demonstrates how to apply the wezterm-cmd-sender plugin's functionality to your WezTerm configuration using the apply_to_config function. This enables the plugin's keybinding for sending commands to multiple panes. ```lua cmd_sender.apply_to_config(config) ``` -------------------------------- ### Require wezterm-cmd-sender Plugin (Lua) Source: https://github.com/aureolebigben/wezterm-cmd-sender/blob/main/README.md This snippet shows how to load the wezterm-cmd-sender plugin using wezterm.plugin.require. It's the first step in integrating the plugin into your WezTerm configuration. ```lua local wezterm = require 'wezterm' local cmd_sender = wezterm.plugin.require("https://github.com/aureolebigben/wezterm-cmd-sender") ``` -------------------------------- ### Apply Keybinding with Custom Options (Lua) Source: https://github.com/aureolebigben/wezterm-cmd-sender/blob/main/README.md This snippet illustrates how to apply the wezterm-cmd-sender plugin with custom keybinding and description options. It allows users to modify the default key and its associated description for sending commands to all panes in the active tab. ```lua cmd_sender.apply_to_config(config, { key = 'mapped:s', mods = 'CMD|SHIFT', description = 'Enter command to send to all panes of active tab' }) ``` -------------------------------- ### apply_to_config Source: https://context7.com/aureolebigben/wezterm-cmd-sender/llms.txt Registers a keybinding to trigger the command sender functionality within the WezTerm configuration. ```APIDOC ## Lua Function: apply_to_config ### Description Registers a keybinding to trigger the command sender prompt. It automatically initializes the keys table if it does not exist and appends the command sender keybinding. ### Parameters - **config** (table) - Required - The WezTerm config object. - **options** (table) - Optional - Configuration table containing `key`, `mods`, and `description`. ### Request Example ```lua cmd_sender.apply_to_config(config, { key = 'mapped:b', mods = 'CTRL|ALT', description = 'Broadcast command to all panes' }) ``` ``` -------------------------------- ### Apply WezTerm Command Sender to Config (Lua) Source: https://context7.com/aureolebigben/wezterm-cmd-sender/llms.txt Registers a keybinding to trigger the command sender functionality. It accepts the WezTerm config object and optional parameters for customizing the keybinding and prompt. This function initializes necessary tables and appends the command sender keybinding. ```lua local wezterm = require 'wezterm' local cmd_sender = wezterm.plugin.require("https://github.com/aureolebigben/wezterm-cmd-sender") local config = wezterm.config_builder() -- Basic usage with default keybinding (CMD+SHIFT+S) cmd_sender.apply_to_config(config) -- Custom configuration with different keybinding and description cmd_sender.apply_to_config(config, { key = 'mapped:b', -- Custom key mapping mods = 'CTRL|ALT', -- Custom modifier keys description = 'Broadcast command to all panes' -- Custom prompt text }) return config ``` -------------------------------- ### WezTerm Action for Sending Command to Tab Panes (Lua) Source: https://context7.com/aureolebigben/wezterm-cmd-sender/llms.txt Returns a WezTerm action callback function for keybinding configurations. When triggered, it prompts the user for input and sends the entered command to all panes in the active tab. This function is used internally by `apply_to_config` but can be used independently. ```lua local wezterm = require("wezterm") local cmd_sender = wezterm.plugin.require("https://github.com/aureolebigben/wezterm-cmd-sender") local config = wezterm.config_builder() -- Manual keybinding setup using the action callback config.keys = { { key = 's', mods = 'LEADER', action = wezterm.action.PromptInputLine { description = 'Enter command for all panes', action = cmd_sender.send_cmd_to_tab_panes_action() }, }, } return config ``` -------------------------------- ### send_cmd_to_tab_panes_action Source: https://context7.com/aureolebigben/wezterm-cmd-sender/llms.txt Returns a WezTerm action callback function for use in custom keybindings. ```APIDOC ## Lua Function: send_cmd_to_tab_panes_action ### Description Returns an action callback function that takes input from a prompt and sends it to all panes in the active tab. ### Response - **action** (function) - A WezTerm action callback function. ### Request Example ```lua action = wezterm.action.PromptInputLine { description = 'Enter command', action = cmd_sender.send_cmd_to_tab_panes_action() } ``` ``` -------------------------------- ### Send Command to Specific Panes (Lua) Source: https://context7.com/aureolebigben/wezterm-cmd-sender/llms.txt A low-level function to send a command string to a provided array of WezTerm pane objects. Each pane receives the command followed by a carriage return for automatic execution. This is useful for programmatic control targeting specific panes. ```lua local wezterm = require("wezterm") local cmd_sender = wezterm.plugin.require("https://github.com/aureolebigben/wezterm-cmd-sender") -- Example: Send command to specific panes in a custom action wezterm.on('user-var-changed', function(window, pane, name, value) if name == 'broadcast_cmd' then local tab = window:active_tab() local panes = tab:panes() -- Send to all panes except the first one local target_panes = {} for i = 2, #panes do table.insert(target_panes, panes[i]) end cmd_sender.send_cmd_to_panes(value, target_panes) end end) ``` -------------------------------- ### send_cmd_to_tab_panes Source: https://context7.com/aureolebigben/wezterm-cmd-sender/llms.txt Sends a command to all panes within a specified tab object. ```APIDOC ## Lua Function: send_cmd_to_tab_panes ### Description Convenience function that retrieves all panes from a tab and broadcasts a command to them. ### Parameters - **command** (string) - Required - The command to execute. - **tab** (table) - Required - The WezTerm tab object. ### Request Example ```lua cmd_sender.send_cmd_to_tab_panes('clear', active_tab) ``` ``` -------------------------------- ### send_cmd_to_panes Source: https://context7.com/aureolebigben/wezterm-cmd-sender/llms.txt Sends a command string to a specific array of WezTerm pane objects. ```APIDOC ## Lua Function: send_cmd_to_panes ### Description Sends a command string to a specified array of WezTerm pane objects, appending a carriage return to trigger execution. ### Parameters - **command** (string) - Required - The command to execute. - **panes** (table) - Required - An array of WezTerm pane objects. ### Request Example ```lua cmd_sender.send_cmd_to_panes('ls -la', target_panes) ``` ``` -------------------------------- ### Send Command to All Tab Panes (Lua) Source: https://context7.com/aureolebigben/wezterm-cmd-sender/llms.txt A convenience function that sends a command to all panes within a given tab object. It internally retrieves all panes from the tab and uses `send_cmd_to_panes`. This is ideal when you have a tab reference and need to broadcast a command. ```lua local wezterm = require("wezterm") local cmd_sender = wezterm.plugin.require("https://github.com/aureolebigben/wezterm-cmd-sender") -- Example: Create a custom event that broadcasts to the active tab wezterm.on('broadcast-command', function(window, pane) local tab = window:active_tab() -- Send a predefined command to all panes in the tab cmd_sender.send_cmd_to_tab_panes('clear', tab) end) -- Bind the event to a key in your config config.keys = { { key = 'k', mods = 'CMD|SHIFT', action = wezterm.action.EmitEvent 'broadcast-command', }, } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.