### Complete Plugin Configuration Source: https://context7.com/chrisgve/pivot_panes.wezterm/llms.txt A comprehensive example showing how to initialize the plugin with custom application priorities, shell detection settings, and multiple keybinding strategies for triggering orientation changes. ```lua local wezterm = require("wezterm") local config = {} local pivot_panes = wezterm.plugin.require("https://github.com/chrisgve/pivot_panes.wezterm") pivot_panes.setup({ max_scrollback_lines = 1000, debug = false, priority_apps = { ["bash"] = 10, ["zsh"] = 10, ["fish"] = 10, ["pwsh"] = 10, ["less"] = 5, ["man"] = 5, ["top"] = 5, ["htop"] = 5, ["btop"] = 5, ["lazygit"] = 5, ["tig"] = 5, ["vim"] = 3, ["nvim"] = 3, ["neovim"] = 3, ["nano"] = 3, ["emacs"] = 2, ["code"] = 2 }, shell_detection = { "bash", "zsh", "fish", "sh", "dash", "ksh", "csh", "tcsh", "pwsh" } }) config.keys = { { key = "p", mods = "CTRL|SHIFT|ALT", action = wezterm.action_callback(pivot_panes.toggle_orientation_callback), }, { key = "\\", mods = "LEADER", action = wezterm.action_callback(function(window, pane) local success = pivot_panes.toggle_orientation(pane) if not success then window:toast_notification("Pivot Panes", "Cannot pivot: ensure you have exactly 2 adjacent panes", nil, 4000) end end), } } config.leader = { key = "a", mods = "CTRL", timeout_milliseconds = 1000 } return config ``` -------------------------------- ### Install pivot_panes.wezterm Plugin in WezTerm Configuration Source: https://context7.com/chrisgve/pivot_panes.wezterm/llms.txt This Lua code snippet demonstrates how to add the pivot_panes.wezterm plugin to your WezTerm configuration file. It requires the plugin and sets up a keybinding to trigger the pane orientation toggle functionality. ```lua local wezterm = require("wezterm") local config = {} -- Load the pivot_panes plugin ---@type Pivot local pivot_panes = wezterm.plugin.require("https://github.com/chrisgve/pivot_panes.wezterm") -- Add keybinding for toggling pane orientation config.keys = { { key = "p", mods = "CTRL|SHIFT|ALT", action = wezterm.action_callback(pivot_panes.toggle_orientation_callback), }, } return config ``` -------------------------------- ### pivot_panes.wezterm API Functions Source: https://github.com/chrisgve/pivot_panes.wezterm/blob/main/README.md This Lua code snippet details the public API of the pivot_panes.wezterm plugin. It shows how to configure the plugin using `setup`, use the `toggle_orientation_callback` for keybindings, and directly call `toggle_orientation` to manage pane orientation. ```lua -- Configure the plugin with custom settings pivot_panes.setup(config_table) -- Callback function for use with wezterm.action_callback() in keybindings pivot_panes.toggle_orientation_callback(window, pane) -- Direct function to toggle orientation of a specific pane or tab -- If no argument is provided, uses the current active pane pivot_panes.toggle_orientation(tab_or_pane) ``` -------------------------------- ### Install and Configure pivot_panes.wezterm Plugin in WezTerm Source: https://github.com/chrisgve/pivot_panes.wezterm/blob/main/README.md This Lua code snippet demonstrates how to add the pivot_panes.wezterm plugin to your WezTerm configuration. It includes requiring the plugin, setting up a keybinding to toggle pane orientation, and optionally configuring plugin settings like scrollback preservation and application priorities. ```lua local wezterm = require("wezterm") local config = {} -- Add the plugin ---@type Pivot local pivot_panes = wezterm.plugin.require("https://github.com/chrisgve/pivot_panes.wezterm") -- Add keybinding config.keys = { -- Other key assignments... { key = "p", mods = "CTRL|SHIFT|ALT", action = wezterm.action_callback(pivot_panes.toggle_orientation_callback), }, } -- Optional: Configure the plugin pivot_panes.setup({ max_scrollback_lines = 1000, debug = false, priority_apps = { -- Custom application priorities ["less"] = 5, ["nvim"] = 3, }, }) return config ``` -------------------------------- ### Toggle Pane Orientation Programmatically Source: https://context7.com/chrisgve/pivot_panes.wezterm/llms.txt Demonstrates how to use the toggle_orientation function within a custom WezTerm action callback. It includes a check to ensure at least two panes exist before attempting the pivot and provides user feedback via toast notifications. ```lua local wezterm = require("wezterm") local config = {} ---@type Pivot local pivot_panes = wezterm.plugin.require("https://github.com/chrisgve/pivot_panes.wezterm") config.keys = { { key = "r", mods = "CTRL|SHIFT|ALT", action = wezterm.action_callback(function(window, pane) local tab = window:active_tab() local panes = tab:panes_with_info() if #panes < 2 then window:toast_notification("pivot_panes", "Need at least 2 panes to pivot", nil, 3000) return end local success = pivot_panes.toggle_orientation(pane) if success then window:toast_notification("pivot_panes", "Pane orientation toggled!", nil, 2000) else window:toast_notification("pivot_panes", "Failed to toggle orientation", nil, 3000) end end), }, } return config ``` -------------------------------- ### pivot_panes.wezterm Configuration Options Source: https://github.com/chrisgve/pivot_panes.wezterm/blob/main/README.md This JSON object outlines the configurable options for the pivot_panes.wezterm plugin. It details settings for maximum scrollback lines, application priorities for state preservation, shell detection, and debug logging. ```json { "max_scrollback_lines": 1000, "priority_apps": { "bash": 10, "zsh": 10, "fish": 10, "less": 5, "man": 5, "top": 5, "htop": 5, "btop": 5, "lazygit": 5, "vim": 3, "nvim": 3, "neovim": 3, "emacs": 2, "nano": 3, }, "shell_detection": { "bash", "zsh", "fish", "sh", "dash", "ksh", "csh", "tcsh" }, "debug": false } ``` -------------------------------- ### Configure pivot_panes.wezterm Plugin Settings Source: https://context7.com/chrisgve/pivot_panes.wezterm/llms.txt This Lua snippet shows how to configure the pivot_panes.wezterm plugin with custom settings. It allows customization of scrollback preservation, application priorities for state restoration, and shell detection. These settings merge with the plugin's defaults. ```lua local wezterm = require("wezterm") local config = {} ---@type Pivot local pivot_panes = wezterm.plugin.require("https://github.com/chrisgve/pivot_panes.wezterm") -- Configure with custom settings pivot_panes.setup({ -- Maximum scrollback lines to preserve (0 to disable) max_scrollback_lines = 2000, -- Enable debug logging for troubleshooting debug = true, -- Custom application priorities (higher = higher priority for state preservation) priority_apps = { -- Shells: highest priority (easiest to restore) ["bash"] = 10, ["zsh"] = 10, ["fish"] = 10, -- Medium priority: state partially preserved ["less"] = 5, ["man"] = 5, ["top"] = 5, ["htop"] = 5, ["btop"] = 5, ["lazygit"] = 5, -- Low priority: complex state hard to restore ["vim"] = 3, ["nvim"] = 3, ["neovim"] = 3, ["emacs"] = 2, ["nano"] = 3, }, -- Custom shell detection list shell_detection = { "bash", "zsh", "fish", "sh", "dash", "ksh", "csh", "tcsh" }, }) config.keys = { { key = "p", mods = "CTRL|SHIFT|ALT", action = wezterm.action_callback(pivot_panes.toggle_orientation_callback), }, } return config ``` -------------------------------- ### Bind pivot_panes.toggle_orientation_callback for Pane Pivoting Source: https://context7.com/chrisgve/pivot_panes.wezterm/llms.txt This Lua code demonstrates how to bind the `pivot_panes.toggle_orientation_callback` function to key combinations in WezTerm. It includes a primary binding for toggling orientation and an alternative binding that displays a toast notification if pivoting fails due to an incorrect number of panes. ```lua local wezterm = require("wezterm") local config = {} ---@type Pivot local pivot_panes = wezterm.plugin.require("https://github.com/chrisgve/pivot_panes.wezterm") -- Basic keybinding using the callback config.keys = { -- Toggle orientation with CTRL+SHIFT+ALT+P { key = "p", mods = "CTRL|SHIFT|ALT", action = wezterm.action_callback(pivot_panes.toggle_orientation_callback), }, -- Alternative binding on F5 { key = "F5", action = wezterm.action_callback(function(window, pane) local success = pivot_panes.toggle_orientation_callback(window, pane) if not success then window:toast_notification("pivot_panes", "Cannot pivot: need exactly 2 adjacent panes", nil, 3000) end end), }, } return config ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.