### Install wezterm-config.nvim Plugin (Neovim) Source: https://github.com/winter-again/wezterm-config.nvim/blob/main/doc/wezterm-config.nvim.txt Configuration for installing the wezterm-config.nvim plugin using lazy.nvim. It includes an option to append Wezterm's configuration directory to Neovim's runtime path for easier module access. ```lua { 'winter-again/wezterm-config.nvim', config = function() -- changing this to true means the plugin will try to append -- $HOME/.config/wezterm' to your RTP, meaning you can more conveniently -- access modules in $HOME/.config/wezterm/lua/ for using with this plugin -- otherwise, store data where you want require('wezterm_config').setup({ -- defaults: append_wezterm_to_rtp = false, }) end } ``` -------------------------------- ### Initialize Wezterm Plugin (Wezterm) Source: https://github.com/winter-again/wezterm-config.nvim/blob/main/doc/wezterm-config.nvim.txt Loads the wezterm-config.nvim plugin within the Wezterm configuration. This setup ensures Wezterm can recognize and utilize the plugin's functionalities. ```lua local wezterm = require('wezterm') local wezterm_config_nvim = wezterm.plugin.require('https://github.com/winter-again/wezterm-config.nvim') -- rest of your config ``` -------------------------------- ### Configure Neovim Plugin Source: https://github.com/winter-again/wezterm-config.nvim/blob/main/README.md Setup the plugin in Neovim using lazy.nvim. The append_wezterm_to_rtp option allows the plugin to access local Wezterm configuration modules. ```lua { 'winter-again/wezterm-config.nvim', config = function() require('wezterm_config').setup({ append_wezterm_to_rtp = false, }) end } ``` -------------------------------- ### Send Simple Wezterm Configuration Overrides from Neovim Source: https://context7.com/winter-again/wezterm-config.nvim/llms.txt Demonstrates using the `set_wezterm_user_var` function in Neovim to send simple configuration overrides to Wezterm. Examples include changing font size, toggling tab bar visibility, and adjusting window opacity. These are set up using Neovim keymaps. ```lua -- Simple key-value override: change font size local wezterm_config = require('wezterm-config') -- Override font size with a keymap vim.keymap.set('n', 'wf', function() wezterm_config.set_wezterm_user_var('font_size', 16) end, { desc = 'Set Wezterm font size to 16' }) -- Toggle tab bar visibility vim.keymap.set('n', 'wt', function() wezterm_config.set_wezterm_user_var('hide_tab_bar_if_only_one_tab', true) end, { desc = 'Hide Wezterm tab bar' }) -- Set window opacity vim.keymap.set('n', 'wo', function() wezterm_config.set_wezterm_user_var('window_background_opacity', 0.9) end, { desc = 'Set Wezterm opacity to 90%' }) ``` -------------------------------- ### Update Wezterm Plugins Source: https://github.com/winter-again/wezterm-config.nvim/blob/main/doc/wezterm-config.nvim.txt Triggers an update for all installed Wezterm plugins. This can be bound to a keymap to manually refresh plugins if automatic reloading is disabled. ```lua wezterm.plugin.update_all() ``` -------------------------------- ### Send Complex Lua Table Wezterm Configurations from Neovim Source: https://context7.com/winter-again/wezterm-config.nvim/llms.txt Illustrates how to send complex Lua table configurations to Wezterm using `set_wezterm_user_var`. This is useful for Wezterm options like `background` or `colors` that accept structured data. The examples show setting a solid color background and a background with an image overlay. ```lua local wezterm_config = require('wezterm-config') -- Override background with a solid color vim.keymap.set('n', 'wb1', function() wezterm_config.set_wezterm_user_var('background', { { source = { Color = '#1a1b26', }, width = '100%', height = '100%', opacity = 1.0, }, }) end, { desc = 'Set solid dark background' }) -- Override background with an image vim.keymap.set('n', 'wb2', function() wezterm_config.set_wezterm_user_var('background', { { source = { File = '/path/to/wallpaper.png', }, width = 'Cover', height = 'Cover', horizontal_align = 'Center', vertical_align = 'Middle', opacity = 0.15, }, { source = { Color = '#1a1b26', }, width = '100%', height = '100%', opacity = 0.85, }, }) end, { desc = 'Set background with image overlay' }) ``` -------------------------------- ### Configure Wezterm Background Override (Neovim) Source: https://github.com/winter-again/wezterm-config.nvim/blob/main/doc/wezterm-config.nvim.txt Configures the wezterm-config.nvim plugin to use custom background settings defined in a separate Lua module. This example demonstrates setting the Wezterm background using a pre-defined profile. ```lua { 'winter-again/wezterm-config.nvim', config = function() require('wezterm_config').setup({ append_wezterm_to_rtp = true, }) local profile_data = require('profile_data') -- this is ~/.config/wezterm/lua/profile_data.lua vim.keymap.set('n', '1', function() ``` -------------------------------- ### Setup Wezterm Plugin to Receive Neovim Config Overrides Source: https://context7.com/winter-again/wezterm-config.nvim/llms.txt This Lua code configures the Wezterm side of the integration. It loads the wezterm-config.nvim plugin and registers a callback for the 'user-var-changed' event. This callback processes incoming configuration overrides sent from Neovim and applies them to the Wezterm window. ```lua -- In your wezterm.lua config file local wezterm = require('wezterm') local wezterm_config_nvim = wezterm.plugin.require('https://github.com/winter-again/wezterm-config.nvim') local config = wezterm.config_builder() -- Register the callback to handle config overrides from Neovim wezterm.on('user-var-changed', function(window, pane, name, value) local overrides = window:get_config_overrides() or {} overrides = wezterm_config_nvim.override_user_var(overrides, name, value) window:set_config_overrides(overrides) end) return config ``` -------------------------------- ### Override Wezterm Font Size (Neovim) Source: https://github.com/winter-again/wezterm-config.nvim/blob/main/doc/wezterm-config.nvim.txt Example keymap in Neovim to override Wezterm's font size. It uses the `set_wezterm_user_var` function from the plugin to send the desired font size to Wezterm. ```lua -- in Neovim local wezterm_config = require('wezterm-config') vim.keymap.set('n', 'f', function() wezterm_config.set_wezterm_user_var('font_size', '20') end) ``` -------------------------------- ### Configure Wezterm Plugin Listener Source: https://github.com/winter-again/wezterm-config.nvim/blob/main/README.md Integrate the plugin into Wezterm's configuration to listen for user variable changes sent from Neovim. This requires importing the plugin and registering a user-var-changed event handler. ```lua local wezterm = require('wezterm') local wezterm_config_nvim = wezterm.plugin.require('https://github.com/winter-again/wezterm-config.nvim') wezterm.on('user-var-changed', function(window, pane, name, value) local overrides = window:get_config_overrides() or {} overrides = wezterm_config_nvim.override_user_var(overrides, name, value) window:set_config_overrides(overrides) end) ``` -------------------------------- ### Define Complex Config Profiles Source: https://github.com/winter-again/wezterm-config.nvim/blob/main/README.md Create a Lua module to store complex configuration structures, such as background settings, which can be passed to the plugin as tables. ```lua local M = {} M.background = { bg_1 = { { source = { File = '...' }, width = '...', }, }, } return M ``` -------------------------------- ### Handle User Variable Changes (Wezterm) Source: https://github.com/winter-again/wezterm-config.nvim/blob/main/doc/wezterm-config.nvim.txt Sets up an event listener in Wezterm to respond to user variable changes. This function updates Wezterm's configuration overrides based on values sent from Neovim via the plugin. ```lua wezterm.on('user-var-changed', function(window, pane, name, value) local overrides = window:get_config_overrides() or {} overrides = wezterm_config_nvim.override_user_var(overrides, name, value) window:set_config_overrides(overrides) end) ``` -------------------------------- ### Define and Apply Profile Data Modules Source: https://context7.com/winter-again/wezterm-config.nvim/llms.txt Create a Lua module to store reusable configuration profiles like backgrounds and font sizes. These profiles can be referenced in Neovim to dynamically update Wezterm settings via user variables. ```lua -- ~/.config/wezterm/lua/profile_data.lua local M = {} M.backgrounds = { tokyo_night = { { source = { Color = '#1a1b26' }, width = '100%', height = '100%', opacity = 1.0 }, }, gruvbox = { { source = { Color = '#282828' }, width = '100%', height = '100%', opacity = 1.0 }, }, transparent = { { source = { Color = '#000000' }, width = '100%', height = '100%', opacity = 0.8 }, }, } M.font_sizes = { small = 12, medium = 14, large = 18, presentation = 24 } return M -- In your Neovim config require('wezterm_config').setup({ append_wezterm_to_rtp = true }) local profiles = require('profile_data') vim.keymap.set('n', 'w1', function() require('wezterm-config').set_wezterm_user_var('background', profiles.backgrounds.tokyo_night) end) ``` -------------------------------- ### Define Wezterm Background Profiles (Lua Module) Source: https://github.com/winter-again/wezterm-config.nvim/blob/main/doc/wezterm-config.nvim.txt A Lua module defining background configurations for Wezterm. This allows for complex background settings, such as image sources and dimensions, to be managed externally and referenced by the plugin. ```lua local M = {} M.background = { bg_1 = { { source = { File = '...', }, width = '...', -- ... }, }, -- ... } return M ``` -------------------------------- ### Clear Wezterm Config Overrides Source: https://github.com/winter-again/wezterm-config.nvim/blob/main/README.md This Lua snippet shows how to set up a keymap in Wezterm to clear all configuration overrides. It defines an event listener for 'clear-overrides' and maps Ctrl+Shift+X to trigger this event, optionally displaying a toast notification. ```lua wezterm.on('clear-overrides', function(window, pane) window:set_config_overrides({}) -- optionally have a small notification pop -- the timeout is known to be unreliable window:toast_notification('wezterm', 'config overrides cleared', nil, 2000) end) local override_keymap = { key = 'X', mods = 'CTRL|SHIFT', action = wezterm.action.EmitEvent('clear-overrides') } table.insert(config.keys, override_keymap) ``` -------------------------------- ### Override Wezterm Config from Neovim Source: https://github.com/winter-again/wezterm-config.nvim/blob/main/README.md Use the plugin's set_wezterm_user_var function to update Wezterm configuration properties dynamically via keymaps. ```lua local wezterm_config = require('wezterm-config') vim.keymap.set('n', 'f', function() wezterm_config.set_wezterm_user_var('font_size', '20') end) ``` -------------------------------- ### Configure Tmux Compatibility Source: https://context7.com/winter-again/wezterm-config.nvim/llms.txt Enable passthrough mode in tmux to ensure escape sequences from Neovim reach the Wezterm terminal emulator correctly. ```bash # In ~/.tmux.conf set -g allow-passthrough on ``` ```lua -- No additional Neovim configuration needed for tmux support local wezterm_config = require('wezterm-config') vim.keymap.set('n', 'wf', function() wezterm_config.set_wezterm_user_var('font_size', 16) end) ``` -------------------------------- ### Clear Configuration Overrides Source: https://context7.com/winter-again/wezterm-config.nvim/llms.txt Define a custom event and keybinding to reset all active Wezterm configuration overrides, restoring the default terminal state. ```lua wezterm.on('clear-overrides', function(window, pane) window:set_config_overrides({}) window:toast_notification('wezterm', 'Config overrides cleared', nil, 2000) end) config.keys = { { key = 'X', mods = 'CTRL|SHIFT', action = wezterm.action.EmitEvent('clear-overrides') }, } ``` -------------------------------- ### Configure Tmux for Wezterm Passthrough Source: https://github.com/winter-again/wezterm-config.nvim/blob/main/doc/wezterm-config.nvim.txt Enables user variable passthrough in tmux, which is required for certain Wezterm features to function correctly when running inside a tmux session. ```conf set -g allow-passthrough on ``` -------------------------------- ### Clear Wezterm Config Overrides Source: https://github.com/winter-again/wezterm-config.nvim/blob/main/doc/wezterm-config.nvim.txt Defines an event to clear all active config overrides and registers a keybinding (Ctrl+Shift+X) to trigger it. This is useful for resetting the terminal state after configuration errors. ```lua wezterm.on('clear-overrides', function(window, pane) window:set_config_overrides({}) window:toast_notification('wezterm', 'config overrides cleared', nil, 2000) end) local override_keymap = { key = 'X', mods = 'CTRL|SHIFT', action = wezterm.action.EmitEvent('clear-overrides') } table.insert(config.keys, override_keymap) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.