Things needed to run claude in a container and integrated with nvim.
  • Shell 55.8%
  • Dockerfile 44.2%
Find a file
2026-10-08 11:47:33 +02:00
claude.sh Initial setup - verified 2026-10-08 11:47:33 +02:00
Containerfile Initial setup - verified 2026-10-08 11:47:33 +02:00
README.md Initial setup - verified 2026-10-08 11:47:33 +02:00

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

  1. Navigate to your work dir (cannot be home dir).
  2. Start neovim nvim .
  3. (if 1st run after install) do :Lazy sync.
  4. Start claude code with <leader>cc or :ClaudeCode.
  5. Go through the menu. Then copy the OAuth URL to the browser and authenticate.
  6. Copy the token you get and paste it back to the nvim terminal.
  7. Session is ready.
  8. Toggle CC terminal on/off with <leader>cc.
  9. To exit, do Ctr+c x2 (kills the session, you'll have to auth again next time).