Things needed to run claude in a container and integrated with nvim.
- Shell 55.8%
- Dockerfile 44.2%
| claude.sh | ||
| Containerfile | ||
| README.md | ||
claude
Things needed to run claude in a container and integrated with nvim.
Set-up
Build/Update the container
Clone this repo and navigate into it (so the Containerfile is available in current dir).
podman build --no-cache -t claude-code:latest .
Create wrapper script
Make the wrapper script claude.sh executable:
chmod +x /path/to/claude.sh
Install neovim plugin
Dump this file in ~/.config/nvim/lua/plugins as claude-code.nvim.
return {
"greggh/claude-code.nvim",
dependencies = { "nvim-lua/plenary.nvim" },
cmd = { "ClaudeCode", "ClaudeCodeContinue", "ClaudeCodeResume", "ClaudeCodeVerbose" }, -- Explicitly expose commands
config = function()
local home = vim.fn.expand("$HOME")
require("claude-code").setup {
-- Points Neovim to the Podman wrapper script instead of a local claude npm binary
command = home .. "/Forgejo/claude/claude.sh",
keymaps = {
toggle = {
normal = "<leader>cc", -- Keymap for Normal mode
terminal = "<leader>cc", -- Keymap for Terminal mode (inside Claude)
},
},
-- Optional setup tailored for containers:
window = {
position = "float", -- Float style works exceptionally well with TTY forwarding
enter_insert = true,
},
git = {
use_git_root = true, -- Ensures your wrapper loads at the root of the repo
},
}
end,
}
Setup key-map
In ~/.config/nvim/lua/mappings.lua, reserve the keymap:
vim.keymap.set("n", "<leader>cc", "<cmd>ClaudeCode<CR>", { desc = "Toggle Claude Code" })
Usage
- Navigate to your work dir (cannot be home dir).
- Start neovim
nvim . - (if 1st run after install) do
:Lazy sync. - Start claude code with
<leader>ccor:ClaudeCode. - Go through the menu. Then copy the OAuth URL to the browser and authenticate.
- Copy the token you get and paste it back to the nvim terminal.
- Session is ready.
- Toggle CC terminal on/off with
<leader>cc. - To exit, do
Ctr+cx2 (kills the session, you'll have to auth again next time).