Created to solve the workflow of managing multiple Neovim instances across tmux panes with fuzzy finding.
A Neovim plugin that tracks your open buffers and current file in tmux environment variables. Needs fuzzmux.tmux to enable fuzzy finding and switching between Neovim buffers across different tmux panes.
- Automatic buffer tracking - Tracks all open buffers and syncs to tmux
- Current file tracking - Keeps track of the active buffer
- Auto cleanup - Removes environment variables when Neovim exits
- Pane-specific - Each tmux pane has its own tracked buffers
- Zero configuration - Works out of the box
- Neovim 0.10+ - Uses async APIs when available
fuzzmux-screencast.mp4
- fuzzmux.tmux for the fuzzy finder interface
- Neovim >= 0.10.0
- tmux >= 3.2
- Running Neovim inside a tmux session
Using lazy.nvim
{
'pteroctopus/fuzzmux.nvim',
opts = {
-- Optional configuration
-- Currently no options available
-- This is a placeholder for future configuration
},
}Once installed, fuzzmux.nvim works automatically in the background.
You can check the environment variables set by fuzzmux.nvim:
# From your shell inside tmux
tmux show-environment -g | grep FUZZMUX_
# Or from Neovim command line
:!tmux show-environment -g | grep FUZZMUX_Install fuzzmux.tmux to get fuzzy finding capabilities:
# With TPM - add to ~/.tmux.conf
set -g @plugin 'pteroctopus/fuzzmux.tmux'Then use the buffer switcher:
prefix+ f - Open fuzzy finder for Neovim buffersprefix+ F - Open fuzzy finder with zoom
Fuzzmux offers more keybindings. Check the fuzzmux.tmux README
Normal (without zoom):
prefix+ s - Fuzzy find and switch to a sessionprefix+ p - Fuzzy find and switch to a paneprefix+ w - Fuzzy find and switch to a windowprefix+ f - Fuzzy find and switch to a Neovim buffer
With zoom (uppercase keys):
prefix+ S - Fuzzy find and switch to a session (with zoom)prefix+ P - Fuzzy find and switch to a pane (with zoom)prefix+ W - Fuzzy find and switch to a window (with zoom)prefix+ F - Fuzzy find and switch to a Neovim buffer (with zoom)
fuzzmux.nvim sets tmux global environment variables that contain information about your Neovim buffers:
# List of all open buffers in a specific pane (colon-separated)
FUZZMUX_OPEN_FILES_<pane_id>="/path/to/file1.txt:/path/to/file2.lua:/path/to/file3.md"
# Currently active buffer in a specific pane
FUZZMUX_CURRENT_FILE_<pane_id>="/path/to/current/file.lua"
# Neovim socket path for a specific pane
FUZZMUX_NVIM_SOCKET_<pane_id>="/path/to/nvim/socket"These variables are automatically updated when you:
- Open a new buffer
- Close a buffer
- Switch between buffers
- Start or exit Neovim
The fuzzmux.tmux plugin reads these variables to provide fuzzy finding capabilities.
fuzzmux.nvim creates autocommands for the following events:
| Event |
|---|
BufEnter |
VimEnter |
BufAdd |
BufDelete |
VimLeavePre |
- Caching: Session, window, and pane identifiers are cached on first query
- Async operations: Uses
vim.system()(Neovim 0.10+) for non-blocking tmux calls - Fallback: Falls back to
vim.fn.system()for older Neovim versions - Selective updates: Only tracks listed buffers with valid file paths
The plugin only tracks buffers that:
- Are valid (
nvim_buf_is_valid) - Are listed (
buflistedoption is true) - Have a non-empty name
- Have an absolute path (starts with
/)
This excludes:
- Unlisted buffers
- Terminal buffers without files
- Special buffers (like
[Command Line]) - Relative paths
The plugin uses a consistent naming convention with fuzzmux.tmux:
FUZZMUX_OPEN_FILES_<pane_id>
FUZZMUX_CURRENT_FILE_<pane_id>Check if Neovim is running inside tmux:
:lua print(os.getenv("TMUX_PANE"))If this returns nil, you're not in a tmux session. fuzzmux.nvim only works inside tmux.
Check if the plugin is loaded:
:lua print(vim.g.loaded_fuzzmux_nvim)Should return 1. If it returns nil, the plugin isn't loaded.
Check for errors in Neovim:
:messagesManually trigger an update:
:lua require('fuzzmux.tmux').set_open_files()
:lua require('fuzzmux.tmux').set_current_file()This is expected behavior if Neovim crashes or is force-killed. Normally, the VimLeavePre autocommand handles cleanup. Stale variables don't cause issues and will be overwritten on next launch.
While fuzzmux.nvim is designed to work automatically, you can access its functions programmatically:
local tmux = require('fuzzmux.tmux')
-- Check if running in tmux
if tmux.is_tmux() then
-- Manually update current file
tmux.set_current_file()
-- Manually update open files list
tmux.set_open_files()
-- Clean up current file variable
tmux.unset_current_file()
-- Clean up open files variable
tmux.unset_open_files()
endWhen working with tmux and Neovim:
- You have multiple tmux panes, each running different Neovim instances
- Each Neovim instance has multiple buffers open
- Switching to a specific file across panes requires:
- Finding which pane has the Neovim instance
- Switching to that pane
- Switching to the correct buffer
fuzzmux provides:
- One keybinding to see all files open in all Neovim instances
- Fuzzy search to quickly find the file you want
- Automatic switching to the correct pane and buffer
- Live preview of file contents before switching
- fuzzmux.tmux - tmux plugin with fuzzy finder interface
- fzf - Command-line fuzzy finder
- tmux - Terminal multiplexer