Skip to content

feat: add terminal_enabled config flag for the built in nvim terminal #73

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mpataki
Copy link

@mpataki mpataki commented Jul 7, 2025

This change adds an enable_terminal config flag which controls whether the plugin will use a nvim terminal buffer to run claude code (as it currently does by default). This flag defaults to true, thereby retaining the current behaviour and maintaining backward compatibility for existing users.

Reasoning behind this, some users like myself prefer to use a terminal multiplexer like tmux or zellij to run claude code. While nvim terminal buffers make great sense as a default, claudecode.nvim needn't mandate them as the only way to run claude code IMHO.

@refractalize
Copy link

refractalize commented Jul 14, 2025

Just what I was looking for, thanks @mpataki!

Here's a vim command that will copy the commandline to the clipboard so you can paste it into your nearest (external) terminal:

vim.api.nvim_create_user_command("ClaudeCodeCopyCommand", function(opts)
  local claudecode = require("claudecode")
  if not claudecode.state or not claudecode.state.port then
    vim.notify("Claude Code Neovim MCP Server is not running", vim.log.levels.ERROR)
    return
  end
  local port = claudecode.state.port
  vim.fn.setreg("+", "CLAUDE_CODE_SSE_PORT=" .. port .. " ENABLE_IDE_INTEGRATION=true FORCE_CODE_TERMINAL=true claude")
  vim.notify("Claude Code command copied to clipboard", vim.log.levels.INFO)
end, {})

This will copy the following to your clipboard:

CLAUDE_CODE_SSE_PORT=48464 ENABLE_IDE_INTEGRATION=true FORCE_CODE_TERMINAL=true claude

From there you can paste it into you favourite terminal.

Edit

Just realised that you can also connect a running claude code instance to neovim by using the /ide command in claude.

You just need to start the WebSocket server by running require('claudecode').start(), or just require('claudecode') depending on your auto_start setting.

│  Select IDE                                                                                                                                                                                                                                │
│  Connect to an IDE for integrated development features.                                                                                                                                                                                    │
│                                                                                                                                                                                                                                            │
│   ❯ 1. Neovim✔                                                                                                                                                                                                                             │
│     2. None                                                                                                                                                                                                                                │
│                                                                                                                                                                                                                                            │
│  ※ Tip: You can enable auto-connect to IDE in /config or with the --ide flag

@jsulopzs
Copy link

jsulopzs commented Jul 19, 2025

This is great because the current terminal fails on pasting full long text

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants