|
| 1 | +-- Bootstrap lazy.nvim |
| 2 | +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" |
| 3 | +if not (vim.uv or vim.loop).fs_stat(lazypath) then |
| 4 | + local lazyrepo = "https://github.com/folke/lazy.nvim.git" |
| 5 | + local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) |
| 6 | + if vim.v.shell_error ~= 0 then |
| 7 | + vim.api.nvim_echo({ |
| 8 | + { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, |
| 9 | + { out, "WarningMsg" }, |
| 10 | + { "\nPress any key to exit..." }, |
| 11 | + }, true, {}) |
| 12 | + vim.fn.getchar() |
| 13 | + os.exit(1) |
| 14 | + end |
| 15 | +end |
| 16 | +vim.opt.rtp:prepend(lazypath) |
| 17 | + |
| 18 | +vim.g.mapleader = " " |
| 19 | +vim.g.maplocalleader = "\\" |
| 20 | + |
| 21 | +-- Resolve the claudecode.nvim checkout that owns this fixture (XDG_CONFIG_HOME is |
| 22 | +-- the `fixtures/` dir under the `vv` launcher, so its parent is the repo root). |
| 23 | +-- Works from a normal checkout or a git worktree. |
| 24 | +local repo_root = vim.fn.fnamemodify(vim.env.XDG_CONFIG_HOME or vim.fn.getcwd(), ":h") |
| 25 | +vim.g.claudecode_dev_dir = repo_root |
| 26 | + |
| 27 | +require("lazy").setup({ |
| 28 | + spec = { |
| 29 | + { import = "plugins" }, |
| 30 | + }, |
| 31 | + install = { colorscheme = { "habamax" } }, |
| 32 | + checker = { enabled = false }, |
| 33 | +}) |
| 34 | + |
| 35 | +-- Window navigation like the issue reporter's setup (Ctrl-h / Ctrl-l). The |
| 36 | +-- terminal-mode maps leave terminal mode FIRST, then move -- so any jump back to |
| 37 | +-- the bottom is caused by the provider re-entering insert mode, not by the maps. |
| 38 | +vim.keymap.set("n", "<C-h>", "<C-w>h", { silent = true, desc = "Window left" }) |
| 39 | +vim.keymap.set("n", "<C-l>", "<C-w>l", { silent = true, desc = "Window right" }) |
| 40 | +vim.keymap.set("t", "<C-h>", [[<C-\><C-n><C-w>h]], { silent = true, desc = "Window left (from terminal)" }) |
| 41 | +vim.keymap.set("t", "<C-l>", [[<C-\><C-n><C-w>l]], { silent = true, desc = "Window right (from terminal)" }) |
| 42 | +vim.keymap.set("t", "<Esc><Esc>", [[<C-\><C-n>]], { silent = true, desc = "Exit terminal mode (double esc)" }) |
| 43 | + |
| 44 | +-- Make the current mode + window visible in EVERY window's statusline so a |
| 45 | +-- terminal snapshot reveals whether we landed in Normal ('n') or Terminal ('t') |
| 46 | +-- mode after switching back. |
| 47 | +vim.o.laststatus = 2 |
| 48 | +vim.o.statusline = " MODE=%{mode()} win=%{winnr()} %f " |
| 49 | + |
| 50 | +-- One-shot layout helper so the reproduction is deterministic and scriptable: |
| 51 | +-- 1. edit the sample file in the left window |
| 52 | +-- 2. open the Claude terminal (focused) in a right split |
| 53 | +-- After calling this you are IN the terminal, in terminal mode, at the bottom. |
| 54 | +_G.repro_setup = function() |
| 55 | + vim.cmd("edit " .. vim.fn.fnameescape(vim.g.claudecode_dev_dir .. "/fixtures/issue-232/example/notes.md")) |
| 56 | + require("claudecode.terminal").simple_toggle({}, nil) |
| 57 | +end |
| 58 | +vim.api.nvim_create_user_command("Repro", _G.repro_setup, { desc = "Set up issue #232 reproduction layout" }) |
| 59 | + |
| 60 | +vim.schedule(function() |
| 61 | + local provider = vim.env.CLAUDECODE_PROVIDER or "snacks" |
| 62 | + vim.notify( |
| 63 | + ("[issue-232] provider=%s -- run :Repro (or <leader>r), then in the terminal: <C-\\><C-n>, gg, <C-h>, <C-l>"):format( |
| 64 | + provider |
| 65 | + ), |
| 66 | + vim.log.levels.INFO |
| 67 | + ) |
| 68 | +end) |
| 69 | + |
| 70 | +vim.keymap.set("n", "<leader>r", "<cmd>Repro<cr>", { desc = "issue-232 repro layout" }) |
0 commit comments