### Configure slimux.nvim with lazy.nvim Source: https://github.com/evwilson/slimux.nvim/blob/master/README.md Example setup for slimux.nvim using lazy.nvim for installation and configuration. It sets up keymaps for sending highlighted and paragraph text to a specified tmux pane. ```lua require("lazy").setup({ { 'EvWilson/slimux.nvim', config = function() local slimux = require('slimux') slimux.setup({ target_socket = slimux.get_tmux_socket(), target_pane = string.format('%s.2', slimux.get_tmux_window()), }) vim.keymap.set('v', 'r', slimux.send_highlighted_text, { desc = 'Send currently highlighted text to configured tmux pane' }) vim.keymap.set('n', 'r', slimux.send_paragraph_text, { desc = 'Send paragraph under cursor to configured tmux pane' }) end } }) ``` -------------------------------- ### Install and Configure slimux.nvim with lazy.nvim Source: https://context7.com/evwilson/slimux.nvim/llms.txt Demonstrates how to install slimux.nvim using the lazy.nvim package manager and configure its basic settings, including target socket, target pane, and keymaps for sending text. It also shows how to set up custom escaped characters. ```lua require("lazy").setup({ { 'EvWilson/slimux.nvim', config = function() local slimux = require('slimux') slimux.setup({ -- Automatically detect current tmux socket target_socket = slimux.get_tmux_socket(), -- Target second pane in current window (format: window.pane) target_pane = string.format('%s.2', slimux.get_tmux_window()), -- Optional: customize escaped characters (defaults shown) escaped_strings = { '\\', ';', '"', '$', '\'' } }) -- Set up keymaps for sending text vim.keymap.set('v', 'r', slimux.send_highlighted_text, { desc = 'Send currently highlighted text to configured tmux pane' }) vim.keymap.set('n', 'r', slimux.send_paragraph_text, { desc = 'Send paragraph under cursor to configured tmux pane' }) end } }) ``` -------------------------------- ### Get Tmux Socket Path with slimux.nvim Source: https://context7.com/evwilson/slimux.nvim/llms.txt Explains how to retrieve the current tmux socket path using the `get_tmux_socket` function. This is essential for establishing communication between Neovim and tmux, and is often used during plugin setup. ```lua local slimux = require('slimux') -- Get the current tmux socket path local socket = slimux.get_tmux_socket() -- Returns: "/private/tmp/tmux-501/default" (example path) -- Use in setup configuration slimux.setup({ target_socket = slimux.get_tmux_socket(), target_pane = '0.1' }) ``` -------------------------------- ### Custom Escaped Strings Configuration Source: https://github.com/evwilson/slimux.nvim/blob/master/README.md Shows the default configuration for strings that need to be escaped before being sent to tmux. This can be overridden in the setup function. ```lua escaped_strings = { '\\', ';', '"', '$', ''' } ``` -------------------------------- ### Get Tmux Window Index with slimux.nvim Source: https://context7.com/evwilson/slimux.nvim/llms.txt Details the `get_tmux_window` function, which retrieves the index of the currently active tmux window. This function is useful for dynamically targeting panes within the active window. ```lua local slimux = require('slimux') -- Get the current window index local window = slimux.get_tmux_window() -- Returns: "0" (first window) or "1", "2", etc. -- Target pane 2 in the current window slimux.setup({ target_socket = slimux.get_tmux_socket(), target_pane = string.format('%s.2', slimux.get_tmux_window()) }) ``` -------------------------------- ### Configure slimux.nvim for REPL Development (Lua) Source: https://context7.com/evwilson/slimux.nvim/llms.txt This Lua code snippet demonstrates a complete configuration for slimux.nvim. It initializes the plugin, sets up keymaps for sending highlighted text or paragraphs to a tmux pane, and configures commands for pane switching and displaying configuration. It requires the 'lazy.nvim' plugin manager. ```lua require("lazy").setup({ { 'EvWilson/slimux.nvim', config = function() local slimux = require('slimux') -- Initialize with auto-detected socket and second pane in current window slimux.setup({ target_socket = slimux.get_tmux_socket(), target_pane = string.format('%s.1', slimux.get_tmux_window()), escaped_strings = { '\\', ';', '"', '$', '\'' } }) -- Standard send keymaps vim.keymap.set('v', 'r', slimux.send_highlighted_text, { desc = 'Send selection to tmux' }) vim.keymap.set('n', 'r', slimux.send_paragraph_text, { desc = 'Send paragraph to tmux' }) -- Delayed send for demonstrations vim.keymap.set('v', 'R', function() slimux.send_highlighted_text_with_delay_ms(50) end, { desc = 'Send selection slowly' }) vim.keymap.set('n', 'R', function() slimux.send_paragraph_text_with_delay_ms(50) end, { desc = 'Send paragraph slowly' }) -- Quick pane switching commands vim.api.nvim_create_user_command('SlimuxPane', function(opts) slimux.configure_target_pane(opts.args) slimux.print_config() end, { nargs = 1, desc = 'Set slimux target pane' }) -- Print current config vim.keymap.set('n', 'rc', slimux.print_config, { desc = 'Show slimux config' }) -- Send interrupt signal vim.keymap.set('n', 'ri', function() slimux.send('^C') end, { desc = 'Send Ctrl+C to tmux pane' }) end } }) ``` -------------------------------- ### Print Current Configuration with slimux.nvim Source: https://context7.com/evwilson/slimux.nvim/llms.txt Demonstrates the `print_config` function, which displays the current slimux configuration (socket and pane settings) in the Neovim message area. This is useful for debugging and verifying settings. ```lua local slimux = require('slimux') -- Display current configuration slimux.print_config() -- Output: "socket: /private/tmp/tmux-501/default, pane: 0.1" -- Can be called from command mode for quick inspection -- :lua require('slimux').print_config() ``` -------------------------------- ### Configure Target Tmux Pane with slimux.nvim Source: https://context7.com/evwilson/slimux.nvim/llms.txt Shows how to use `configure_target_pane` to dynamically change the target tmux pane at runtime. The function accepts the standard tmux target format (window.pane). ```lua local slimux = require('slimux') -- Change target to second pane in first window slimux.configure_target_pane('0.1') -- Change target to third pane in second window slimux.configure_target_pane('1.2') -- Can also be called from command mode -- :lua require('slimux').configure_target_pane('0.1') ``` -------------------------------- ### Configure Target Tmux Socket with slimux.nvim Source: https://context7.com/evwilson/slimux.nvim/llms.txt Illustrates the use of `configure_target_socket` for dynamically updating the target tmux socket path. This is beneficial when managing multiple tmux sessions or non-standard socket locations. ```lua local slimux = require('slimux') -- Configure a specific socket path slimux.configure_target_socket('/tmp/tmux-1000/default') -- Switch to a named tmux session socket slimux.configure_target_socket('/tmp/tmux-501/my-session') ``` -------------------------------- ### Configure Target Pane On-the-Fly Source: https://github.com/evwilson/slimux.nvim/blob/master/README.md Demonstrates how to dynamically change the target tmux pane for sending text using the `configure_target_pane` function. ```vimscript :lua require('slimux').configure_target_pane('0.1') ``` -------------------------------- ### Send Highlighted Text with Delay Source: https://github.com/evwilson/slimux.nvim/blob/master/README.md Sends the currently highlighted text to the configured target with a specified delay between characters. This function is synchronous. ```lua send_highlighted_text_with_delay_ms(delay) ``` -------------------------------- ### Send Paragraph Text with Delay Source: https://github.com/evwilson/slimux.nvim/blob/master/README.md Sends the paragraph under the cursor to the configured target with a specified delay between characters. This function is synchronous. ```lua send_paragraph_text_with_delay_ms(delay) ``` -------------------------------- ### Send Highlighted Text with Delay (Lua) Source: https://context7.com/evwilson/slimux.nvim/llms.txt This function combines capturing visually selected text with delayed character-by-character sending. It's designed for creating typing animations or demonstrations of selected code snippets in the tmux pane. ```lua local slimux = require('slimux') -- Set up keymap for slow send (useful for demos) vim.keymap.set('v', 'R', function() slimux.send_highlighted_text_with_delay_ms(75) end, { desc = 'Send highlighted text slowly to tmux' }) -- Create a "presentation mode" keymap vim.keymap.set('v', 'p', function() slimux.send_highlighted_text_with_delay_ms(100) end, { desc = 'Present code with typing effect' }) -- Usage: -- 1. Select text in visual mode -- 2. Press keymap to send with typing animation ``` -------------------------------- ### Customize Escaped Strings with slimux.nvim Source: https://context7.com/evwilson/slimux.nvim/llms.txt Explains how to customize the characters that slimux.nvim automatically escapes before sending text to tmux using `configure_escape_strings`. The default set includes common special characters. ```lua local slimux = require('slimux') -- Use default escape strings -- escaped_strings = { '\\', ';', '"', '$', '\'' } -- Customize escape strings to include additional characters slimux.configure_escape_strings({ '\\', ';', '"', '$', '\'', '`', '!' }) -- Minimal escaping for trusted input slimux.configure_escape_strings({ '\\', '"' }) ``` -------------------------------- ### Send Keystrokes with Delay Source: https://github.com/evwilson/slimux.nvim/blob/master/README.md The `send_delayed` function sends keystrokes to the target pane with a specified delay between each character. This function is synchronous and will block Neovim. ```lua send_delayed(text, delay) ``` -------------------------------- ### Send Keystrokes to Tmux Pane Source: https://github.com/evwilson/slimux.nvim/blob/master/README.md The `send` function sends a string of keystrokes to the configured tmux pane. It can send regular text and control characters. ```lua send(text) ``` -------------------------------- ### Send Keystrokes to Tmux Pane (Lua) Source: https://context7.com/evwilson/slimux.nvim/llms.txt The `send` function transmits a string of keystrokes directly to the active tmux pane. It automatically handles character escaping and appends an Enter keypress. This function is useful for executing commands, running scripts, or sending control characters. ```lua local slimux = require('slimux') -- Send a simple command slimux.send('echo "Hello, World!"') -- Send a Python command to a REPL slimux.send('print("Hello from Neovim")') -- Run a shell command slimux.send('ls -la') -- Send control character (Ctrl+C) to interrupt running process slimux.send('^C') -- Chain multiple commands slimux.send('cd /project && npm run build') ``` -------------------------------- ### Send Paragraph Text to Tmux Pane (Lua) Source: https://context7.com/evwilson/slimux.nvim/llms.txt The `send_paragraph_text` function captures the paragraph under the cursor (defined by empty lines) and sends it to the tmux pane. This is useful for sending multi-line code blocks or commands from normal mode without explicit visual selection. ```lua local slimux = require('slimux') -- Set up normal mode keymap vim.keymap.set('n', 'r', slimux.send_paragraph_text, { desc = 'Send paragraph to tmux pane' }) -- Alternative keymap for code execution vim.keymap.set('n', 'x', slimux.send_paragraph_text, { desc = 'Execute current paragraph in tmux' }) -- Usage: -- 1. Position cursor anywhere within a paragraph (code block) -- 2. Press r to send entire paragraph to tmux pane -- Paragraph boundaries are determined by empty lines ``` -------------------------------- ### Send Highlighted Text to Tmux Pane (Lua) Source: https://context7.com/evwilson/slimux.nvim/llms.txt The `send_highlighted_text` function captures the currently selected text in Neovim's visual mode and sends it to the tmux pane. This is typically mapped to a key combination in visual mode for convenient execution of selected code or commands. ```lua local slimux = require('slimux') -- Set up visual mode keymap vim.keymap.set('v', 'r', slimux.send_highlighted_text, { desc = 'Send highlighted text to tmux pane' }) -- Alternative keymap with different key vim.keymap.set('v', '', slimux.send_highlighted_text, { desc = 'Execute selection in tmux' }) -- Usage: -- 1. Enter visual mode (v, V, or Ctrl+v) -- 2. Select the text you want to send -- 3. Press r to send selection to tmux pane ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.