A tmux terminal provider for claudecode.nvim. Opens Claude Code in a tmux split instead of using Neovim's built-in terminal.
- Neovim 0.8+
- claudecode.nvim
- tmux (must be running inside a tmux session)
{
"mr55p-dev/claude-tmux.nvim",
dependencies = {
"coder/claudecode.nvim",
},
}use {
"mr55p-dev/claude-tmux.nvim",
requires = { "coder/claudecode.nvim" },
}local tmux_provider = require("claude-tmux").setup({
toggle_key = "<C-j>", -- Key to return to neovim (default: "<C-j>")
split_size = 30, -- Split size as percentage (default: 30)
split_side = "bottom", -- "bottom" or "right" (default: "bottom")
})
require("claudecode").setup({
-- your other claudecode options...
terminal = {
provider = tmux_provider,
},
})| Option | Type | Default | Description |
|---|---|---|---|
toggle_key |
string | "<C-j>" |
Key binding to return to Neovim from the Claude pane. Uses Vim key notation. Set to nil to disable. |
split_size |
number | 30 |
Size of the tmux split as a percentage of the window (height or width depending on split_side). |
split_side |
string | "bottom" |
Where to open the split. "bottom" opens a pane below, "right" opens a pane to the right. |
The toggle_key option accepts standard Vim key notation:
- Control keys:
<C-j>,<C-k>, etc. - Alt/Meta keys:
<M-j>,<A-j>, etc. - Function keys:
<F1>,<F12>, etc. - Special keys:
<CR>,<Tab>,<Space>,<Esc>
- When you open Claude Code, the plugin creates a new tmux pane (bottom or right side, depending on
split_side) - A conditional keybinding is set up so that pressing the toggle key (default
<C-j>) while in the Claude pane switches back to Neovim - The keybinding only affects the Claude pane - in other panes, the key passes through normally
- When the Claude terminal is closed, the keybinding is automatically cleaned up
Initialize the provider with the given options. Returns the provider table to pass to claudecode.nvim.
Returns true if running inside tmux, false otherwise. Useful for conditional setup.
Returns the current configuration table.
If you want to use the tmux provider when available, but fall back to the default terminal otherwise:
local claude_tmux = require("claude-tmux")
local terminal_config = {}
if claude_tmux.is_available() then
terminal_config.provider = claude_tmux.setup({
toggle_key = "<C-j>",
split_size = 25,
})
end
require("claudecode").setup({
terminal = terminal_config,
})Make sure you're running Neovim inside a tmux session. The plugin checks for the $TMUX environment variable.
- Verify you're in the Claude pane (not another tmux pane)
- Check that the key notation is correct (e.g.,
<C-j>notCtrl-j) - Ensure no other tmux bindings are conflicting with your chosen key
Check that Claude Code CLI is installed and available in your PATH.
Contributions are welcome! Please feel free to submit issues and pull requests.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Test with claudecode.nvim
- Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Follow existing code patterns
- Add comments for non-obvious logic
- Test changes with both tmux and non-tmux environments
MIT License - see LICENSE for details.