From 1135d22b39a23d2685b6af992a8285d3f4dc9da9 Mon Sep 17 00:00:00 2001 From: The_miro Date: Thu, 23 Jul 2026 10:47:24 +0200 Subject: [PATCH] feat(nvim): switch to coder/claudecode.nvim, document all keybinds MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace greggh/claude-code.nvim (bare terminal wrapper) with coder/claudecode.nvim's native WebSocket bridge — inline diff review, buffer/selection context, model switching. Runs with terminal.provider = "native" to avoid pulling in snacks.nvim. New commands are bound under the previously-unused a prefix, so none of the existing single-key app toggles are disturbed. Move the alot floating-terminal toggle from bare "n" to "m", freeing "n" back to Vim's default repeat-search behavior. Document the full Neovim keybind set (window nav, app toggles, Claude Code, insert-mode completion, misc) in docs/md/editors.md — previously undocumented. Co-Authored-By: Claude Sonnet 5 --- docs/md/editors.md | 72 ++++++++++++++++++++++++++++++++++++++++++++++ nvim/init.lua | 37 ++++++++++++++++++++---- 2 files changed, 103 insertions(+), 6 deletions(-) diff --git a/docs/md/editors.md b/docs/md/editors.md index fb1dd21..fa2daa6 100644 --- a/docs/md/editors.md +++ b/docs/md/editors.md @@ -67,6 +67,12 @@ Config lives in `nvim/`. Deployed to `~/.config/nvim/` during `shell` module ins |--------|---------| | `the_miro/cyberqueer.nvim` | CyberQueer colour scheme (local) | +#### AI + +| Plugin | Purpose | +|--------|---------| +| `coder/claudecode.nvim` | Native WebSocket bridge to the Claude Code CLI — inline diff review, buffer/selection context, model switching. Runs with `terminal.provider = "native"` (no `snacks.nvim` dependency). Replaces the older `greggh/claude-code.nvim` terminal-only wrapper. | + ### CoC LSP Settings `nvim/coc-settings.json` configures language servers for: @@ -78,6 +84,72 @@ Config lives in `nvim/`. Deployed to `~/.config/nvim/` during `shell` module ins `nvim/cyberqueer-airline.vim` — a custom vim-airline theme using the CyberQueer palette, providing hot-pink/violet segments in the status bar. +### Keybindings + +All custom bindings live in `nvim/init.lua`. Leader is the Vim default (`\`), unchanged. + +#### Window navigation + +| Key | Mode | Action | +|-----|------|--------| +| `Ctrl+h` / `Ctrl+j` / `Ctrl+k` | Normal, Terminal | Move to the split left/below/above | +| `Ctrl+l` | Normal, Terminal | Cycle to the next split (wraps) | + +Also restored inside `calendar.vim` buffers, which otherwise steal `Ctrl+hjkl` for month navigation. + +#### Quick app toggles (single key, normal mode) + +| Key | Action | +|-----|--------| +| `t` | Open a new floating terminal (`vim-floaterm`) | +| `e` | Toggle the NERDTree file-tree sidebar | +| `s` | Toggle the `vim-dadbod-ui` database browser | +| `q` | Save & quit; falls back to force-quit on unsaved/read-only buffers | +| `m` | Toggle a centered floating `alot` (email) terminal | +| `g` | Toggle a centered floating `khal interactive` (calendar) terminal | +| `f` | Toggle a centered floating `abook` (contacts) terminal | +| `x` | Toggle the sideward-T PIM overlay (`alot` + `abook` + `khal` panes at once) | + +`m` was previously `n` — moved to free up `n` for its default Vim meaning (repeat last search). + +#### Claude Code (`coder/claudecode.nvim`) + +All under the `a` ("AI") prefix — a namespace that was otherwise completely unused, so nothing above was disturbed. + +| Key | Mode | Action | +|-----|------|--------| +| `ac` | Normal | Toggle the Claude Code terminal | +| `af` | Normal | Focus the Claude Code terminal | +| `ar` | Normal | Resume the last Claude session (`--resume`) | +| `aC` | Normal | Continue the last Claude session (`--continue`) | +| `am` | Normal | Select the Claude model | +| `ab` | Normal | Add the current buffer to Claude's context | +| `as` | Visual | Send the selection to Claude as context | +| `ay` | Normal | Accept the proposed diff | +| `an` | Normal | Deny the proposed diff | +| `aq` | Normal | Close all pending diffs | +| `aS` | Normal | Show Claude connection status | + +#### Insert mode + +| Key | Action | +|-----|--------| +| `Tab` | Next completion entry (CoC popup menu if visible, else built-in keyword completion) | +| `Shift+Tab` | Previous completion entry (CoC popup menu if visible, else literal tab) | +| `Enter` | Confirm the CoC completion if the popup menu is visible | +| `Ctrl+Tab` | Expand an UltiSnips snippet trigger | +| `Ctrl+b` / `Ctrl+z` | Jump forward/backward through UltiSnips snippet placeholders | +| `Ctrl+l` | Expand a CoC snippet | +| `Ctrl+j` | Expand-and-jump a CoC snippet | + +#### Other + +| Key | Mode | Action | +|-----|------|--------| +| `x` | Visual/Select | Convert selection to a UltiSnips snippet (via CoC) | +| `:Vb` | Command | Enter visual-block mode (alternative to `Ctrl+v`, which some terminals intercept) | +| `:w!!` | Command | Save the current file through `sudo tee`, for read-only files | + --- ## Micro diff --git a/nvim/init.lua b/nvim/init.lua index 6dcddd9..7a16f7a 100644 --- a/nvim/init.lua +++ b/nvim/init.lua @@ -50,12 +50,37 @@ require("lazy").setup({ -- glow.nvim: render Markdown in a floating window via the `glow` CLI { "ellisonleao/glow.nvim", config = true }, "itchyny/calendar.vim", -- Interactive calendar; used in the PIM overlay (key "g") - -- claude-code.nvim: Claude Code integration (opens/communicates with the `claude` CLI) + -- claudecode.nvim: native WebSocket bridge to the Claude Code CLI (inline + -- diff review, buffer/selection context, model switching) — replaces the + -- older greggh/claude-code.nvim terminal-only wrapper. + -- terminal.provider = "native" avoids pulling in folke/snacks.nvim just + -- for a terminal split; everything else uses defaults. + -- All bindings live under a ("AI"), previously untouched, so + -- none of the single-key app toggles above (t/e/s/q/m/g/f/x) are disturbed. { - "greggh/claude-code.nvim", - dependencies = { "nvim-lua/plenary.nvim" }, + "coder/claudecode.nvim", + cmd = { + "ClaudeCode", "ClaudeCodeFocus", "ClaudeCodeSelectModel", + "ClaudeCodeAdd", "ClaudeCodeSend", "ClaudeCodeStatus", + "ClaudeCodeDiffAccept", "ClaudeCodeDiffDeny", "ClaudeCodeCloseAllDiffs", + }, + keys = { + { "ac", "ClaudeCode", desc = "Claude: toggle" }, + { "af", "ClaudeCodeFocus", desc = "Claude: focus" }, + { "ar", "ClaudeCode --resume", desc = "Claude: resume session" }, + { "aC", "ClaudeCode --continue", desc = "Claude: continue session" }, + { "am", "ClaudeCodeSelectModel", desc = "Claude: select model" }, + { "ab", "ClaudeCodeAdd %", desc = "Claude: add current buffer" }, + { "as", "ClaudeCodeSend", mode = "v", desc = "Claude: send selection" }, + { "ay", "ClaudeCodeDiffAccept", desc = "Claude: accept diff" }, + { "an", "ClaudeCodeDiffDeny", desc = "Claude: deny diff" }, + { "aq", "ClaudeCodeCloseAllDiffs", desc = "Claude: close all diffs" }, + { "aS", "ClaudeCodeStatus", desc = "Claude: connection status" }, + }, config = function() - require("claude-code").setup() + require("claudecode").setup({ + terminal = { provider = "native" }, + }) end, }, }, { @@ -245,7 +270,7 @@ local function _pim_float(row, col, height, width, border) return win end --- n/g/f: individual centered floating windows +-- m/g/f: individual centered floating windows local _solo = {} local function toggle_solo(key, cmd, label) @@ -268,7 +293,7 @@ local function toggle_solo(key, cmd, label) _solo[key] = win_id end -vim.keymap.set("n", "n", function() toggle_solo("n", "terminal alot", "alot") end, { silent = true }) +vim.keymap.set("n", "m", function() toggle_solo("m", "terminal alot", "alot") end, { silent = true }) vim.keymap.set("n", "g", function() toggle_solo("g", "terminal khal interactive", "khal") end, { silent = true }) vim.keymap.set("n", "f", function() toggle_solo("f", "terminal abook", "abook") end, { silent = true })