A Neovim plugin that connects Neovim with a running GitHub Copilot CLI instance. Send context-rich prompts from your editor directly to Copilot CLI running in another tmux pane.
- 🔍 Smart process detection — Finds running
copilotinstances via process tree traversal (not limited to current tmux window) - 💬 Floating prompt editor near the cursor with multiline editing and placeholder support
- 📄
@file— Current file path (relative) - 📁
@buffers— All open buffer paths - 📍
@here— Cursor position info - ✂️
@selection— Visual selection content - 🔍
@diagnostics— LSP diagnostics for current line - 🖥️ Reliable tmux sending — Uses
load-buffer+paste-buffer(handles long text and special characters) - ⚡ Multi-instance support — Detects multiple Copilot CLI instances and lets you choose
- Neovim >= 0.8.0
tmux— Required for sending messages to Copilot CLIcopilotCLI running in a tmux pane (any session/window)
{
"copilot-cli.nvim",
dev = true,
keys = {
{ "<C-l>", "<cmd>CopilotSend<cr>", desc = "Send prompt to Copilot CLI" },
{ "<C-l>", "<cmd>CopilotSend<cr>", mode = "v", desc = "Send selection to Copilot CLI" },
{ "<leader>cs", "<cmd>CopilotSelect<cr>", desc = "Select Copilot CLI instance" },
},
cmd = {
"CopilotSend",
"CopilotSelect",
},
config = function()
require("copilot-cli").setup()
end,
}Plug 'dustier/copilot-cli.nvim'Then in your Lua config:
require('copilot-cli').setup()
vim.keymap.set({ "n", "v" }, "<C-l>", "<cmd>CopilotSend<cr>", { desc = "Send prompt to Copilot CLI" })
vim.keymap.set("n", "<leader>cf", "<cmd>CopilotFocus<cr>", { desc = "Focus Copilot CLI pane" })use {
'copilot-cli.nvim',
config = function()
require('copilot-cli').setup()
end
}| Command | Description |
|---|---|
:CopilotSend |
Open the floating prompt editor with placeholder support |
:CopilotSelect |
Re-detect and select Copilot CLI instance |
Use these in your prompts to include context:
| Placeholder | Description |
|---|---|
@file |
Current file path (relative to cwd) |
@buffers |
All open buffer file paths |
@here |
Cursor position (file:line) |
@selection |
Visual selection content |
@diagnostics |
LSP diagnostics for the current line |
"Fix this error: @diagnostics""Explain this code: @selection"(select text first)"What does @file do?""Add tests for @file""Help me at @here in @file"
- Insert mode
<CR>— Insert a newline - Normal mode
<CR>— Send the prompt to Copilot CLI <C-s>— Send the prompt to Copilot CLI<C-c>— Cancel and close the prompt editorq— Close the prompt editor in normal mode
- Start tmux and split your terminal
- Run
copilotin one pane - Open Neovim in another pane (can be any tmux session/window)
- Press
<C-l>to open the prompt editor near the cursor - The editor starts as a single line and expands as your prompt grows
- Press
<C-s>to send - The prompt is sent to the Copilot CLI pane automatically
No configuration required — the plugin works out of the box.
Call require("copilot-cli").setup() to initialize (needed for plugin managers that require it).
Unlike simpler approaches that only scan the current tmux window, this plugin uses process tree detection:
- Runs
psto find all processes matchingcopilot(excludinglanguage-server) - Builds a process tree from all running processes
- Lists all tmux panes and their root PIDs
- Maps each copilot process to its containing tmux pane via tree traversal
- Caches the result until the target process exits
This means the Copilot CLI can be running in any tmux session or window — it doesn't need to be in the same window as Neovim.
When multiple Copilot CLI instances are running:
- First prompt triggers a selection dialog to choose which instance to send to
- The selected instance is cached — subsequent prompts go to the same instance automatically
- If the cached instance exits, the next prompt re-detects and prompts again if needed
- Use
:CopilotSelectto manually switch to a different instance at any time
Uses tmux load-buffer + tmux paste-buffer instead of tmux send-keys. This is more reliable for:
- Long prompts with multiple lines
- Special characters and escape sequences
- Unicode content
- Make sure
copilotis running in a tmux pane - Check that the process is visible:
ps aux | grep copilot - Try manual target: set
tmux_target = "%42"(find pane id withtmux list-panes -a -F "#{pane_id} #{pane_current_command}")
- Verify the tmux pane still exists
- Check tmux buffer permissions
# List all tmux panes with their commands
tmux list-panes -a -F '#{pane_id} #{pane_pid} #{pane_current_command}'
# Find copilot processes
ps -u $USER -ww -o pid,ppid,args | grep copilot
# Test manual send
tmux load-buffer -b test - <<< "hello"
tmux paste-buffer -b test -d -r -t %42This plugin was inspired by and builds upon ideas from:
- opencode-context.nvim — Placeholder system and tmux sending approach
- sidekick.nvim — Process tree detection strategy and copilot CLI process matching
MIT License