From 282e5e0f0b1f0b6e40b527e0103a5be6d18f3453 Mon Sep 17 00:00:00 2001 From: ray Date: Wed, 28 Oct 2026 15:43:13 +0000 Subject: [PATCH] adopt neovim 0.12 native editing features --- AGENTS.md | 8 +-- LOG.md | 9 ++- MIGRATION_PLAN.md | 42 +++++++------- README.md | 30 ++++++++-- init.lua | 6 ++ lazy-lock.json | 11 +--- lua/completion.lua | 13 +++++ lua/keymaps.lua | 5 ++ lua/paper-tonic-modern/groups/plugins.lua | 40 +------------ lua/paper-tonic-modern/init.lua | 2 +- lua/plugins/autopairs.lua | 4 -- lua/plugins/cmp.lua | 69 ----------------------- lua/plugins/copilot.lua | 35 ++++++------ lua/plugins/lsp.lua | 19 +++---- lua/plugins/treesitter.lua | 22 ++++---- lua/plugins/undotree.lua | 15 ----- lua/settings.lua | 8 +-- neovim-migration-guide.md | 2 + 18 files changed, 125 insertions(+), 215 deletions(-) create mode 100644 lua/completion.lua delete mode 100644 lua/plugins/cmp.lua delete mode 100644 lua/plugins/undotree.lua diff --git a/AGENTS.md b/AGENTS.md index cfa61f1..6d83828 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -111,15 +111,15 @@ This repository is being migrated to a modern, minimal Neovim setup driven by Lu - ✅ Phase 3: Core editing & LSP (native exrc + vim.lsp.config migration complete) - ✅ Phase 4: Navigation (Telescope and netrw) - ✅ Phase 5: Treesitter (parsers, textobjects, autotag) -- ✅ Phase 6: UX/Editing (Comment, surround, autopairs, indent guides, UFO, undotree) +- ✅ Phase 6: UX/Editing (Comment, surround, autopairs, indent guides, UFO, native Undotree) - ✅ Phase 7: Git integration (Gitsigns) -- ✅ Phase 8: Copilot integration (copilot.lua + copilot-cmp) +- ✅ Phase 8: Copilot integration (copilot.lua inline suggestions) - ✅ Phase 9: Formatting & Linting (conform.nvim, nvim-lint, Mason tool installer) - ✅ Phase 10: Migrate kept behaviors (abbreviations, templates, custom Treesitter queries) - ✅ Phase 11: Modern Paper Tonic colorscheme - ⏳ Phase 12: Cleanup and validation (repository cleanup and automated checks complete; interactive workflow checks remain) -- ⏳ Phase 13: Controlled Neovim 0.12.6 upgrade (configuration audit complete; isolated plugin validation and activation remain) -- 📋 Phase 13.9: Native Undotree and completion consolidation after activation +- ⏳ Phase 13: Neovim 0.12.6 activated; native completion settling checks in progress +- ⏳ Phase 13.9: Native Undotree and completion consolidation implemented; interactive validation remains - 📋 Phase 14: Netrw live previews and directory summaries (planned after upgrade) ## Migration Notes diff --git a/LOG.md b/LOG.md index f66021b..da9a1dc 100644 --- a/LOG.md +++ b/LOG.md @@ -203,6 +203,13 @@ Record every decision here with a short rationale. Append new entries; do not re - 2026-10-28: Disabled lazy.nvim's LuaRocks integration because no configured plugin requires LuaRocks. This removes the irrelevant missing-hererocks health error without adding a system dependency. Candidate health otherwise reports only optional missing language runtimes, the pending inline-Copilot migration, and the `copilot-cmp` deprecation that will disappear with that migration. - 2026-10-28: Adopted the isolated candidate's reviewed plugin lockfile and compatibility adjustments into the main worktree. Production plugin directories remain unchanged until the 0.12 activation step, preserving the working 0.11 rollback environment. - 2026-10-28: Chose the post-activation native-feature direction for 0.12. Keep lazy.nvim because the configuration still benefits from its event/command loading, dependency ordering, and build hooks; do not mix the runtime upgrade with an experimental `vim.pack` migration. After activating 0.12, replace `mbbill/undotree` with the native optional package and trial native insert-mode/LSP completion plus built-in snippets. Copilot will use inline suggestions with a separate accept key rather than appearing in the completion popup; remove the cmp stack only after interactive language and editing validation. +- 2026-10-28: Activated Neovim 0.12.6 with the user-level selector `~/.local/bin/nvim`, which precedes the older `/opt` PATH entry. The root-owned `/opt/neovim` directory could not be reorganized without an interactive sudo password, so 0.11.5 remains intact at `/opt/neovim/nvim-linux-x86_64/bin/nvim`; rollback is `ln -sfn /opt/neovim/nvim-linux-x86_64/bin/nvim ~/.local/bin/nvim`. +- 2026-10-28: Implemented the 0.12 native editing trial. Native `nvim.undotree` now owns `u`; native autocomplete combines LSP omnifunc results and bounded buffer sources after a 150 ms delay, requires explicit selection, accepts with ``, and uses built-in snippet tabstops. Copilot now supplies separate inline ghost text accepted with `` and hides while the completion popup is visible. Removed the nvim-cmp, cmp source, LuaSnip, copilot-cmp, and external Undotree specs, integrations, lock entries, and highlight groups. +- 2026-10-28: Refined native completion after the PTY smoke test showed buffer words sorting ahead of a valid PHP method. LSP-attached buffers now autocomplete exclusively from the LSP omnifunc; `` remains the explicit current-buffer word workflow, and non-LSP buffers retain bounded automatic word completion. This makes the first selectable language result predictable without losing native fallback completion. +- 2026-10-28: Added narrow 0.12 guards around the new `autocomplete` option, source match limits, and optional native Undotree package. The retained 0.11.5 binary can therefore still start the configuration for emergency rollback, although native autocomplete and Undotree are intentionally unavailable until the selector is returned to 0.12.6. +- 2026-10-28: Final smoke testing found that loading `nvim.undotree` before lazy.nvim setup left its command registered but removed its Lua module path. Moved `packadd nvim.undotree` after lazy.nvim finalizes `runtimepath`. The same test showed nvim-ts-autotag attaching to Markdown despite the intended filetype restriction; global autotag actions are now disabled and explicitly enabled only for HTML/PHP/JS/TS/Vue tag-bearing filetypes. +- 2026-10-28: Active-runtime validation passed through the normal `nvim` selector: native Undotree opens, netrw and Telescope load, PHP native completion offers and accepts `greetExternal()` with snippet syntax, Copilot's inline client is authenticated, Markdown no longer runs autotag, and HTML autotag exits Insert mode without errors. `vim.deprecated` is clean. Remaining health warnings are optional missing language runtimes and the harmless unknown `markdown.mdx` filetype hint. +- 2026-10-28: Marked `neovim-migration-guide.md` as historical planning input. Its original Neo-tree, cmp, and plugin assumptions are retained for provenance but no longer compete with the active architecture documents. ## Project-Local Configuration @@ -242,7 +249,7 @@ Neoconf and the earlier layered JSON proposal were rejected. They remain in the - `spelllang = en_gb` - `listchars` and `showbreak` will reuse legacy values. -- `completeopt = menu,menuone,noselect` for `nvim-cmp`. +- `autocomplete` with `completeopt = menu,menuone,noselect,popup,fuzzy` for Neovim 0.12 native completion. ## Process Reminders diff --git a/MIGRATION_PLAN.md b/MIGRATION_PLAN.md index a6f43f5..cc2a896 100644 --- a/MIGRATION_PLAN.md +++ b/MIGRATION_PLAN.md @@ -534,22 +534,22 @@ Source of truth for the step-by-step rebuild. Keep this concise and up to date. - [x] Download the official `nvim-linux-x86_64.tar.gz` release archive - [x] Verify the archive against the SHA-256 digest published with the release - [x] Install into a versioned directory without replacing 0.11.5 -- [ ] Introduce an explicit `current` symlink (or equivalent atomic selector) for the active version -- [ ] Update the external PATH configuration only after both versioned binaries are verified -- [ ] Document the one-command rollback to 0.11.5 +- [x] Introduce an explicit user-level selector for the active version +- [x] Activate 0.12.6 through the existing `~/.local/bin` PATH entry after verifying both binaries +- [x] Document rollback by repointing `~/.local/bin/nvim` to the 0.11.5 binary -Proposed layout: +Installed layout: ```text -/opt/neovim/nvim-0.11.5/ +/opt/neovim/nvim-linux-x86_64/ # 0.11.5 rollback runtime /opt/neovim/nvim-0.12.6/ -/opt/neovim/current -> nvim-0.11.5 +~/.local/bin/nvim -> /opt/neovim/nvim-0.12.6/bin/nvim ``` ## Phase 13.5 — Test 0.12 with the existing plugin lockfile -- [ ] Use isolated `XDG_DATA_HOME`, `XDG_CACHE_HOME`, and `XDG_STATE_HOME` directories +- [x] Use isolated `XDG_DATA_HOME`, `XDG_CACHE_HOME`, and `XDG_STATE_HOME` directories - [ ] Install the currently locked plugin revisions into the isolated data directory -- [ ] Keep the production plugin and Mason directories untouched +- [x] Keep the production plugin and Mason directories untouched during candidate testing - [x] Validate headless startup and capture startup time - [x] Run `:checkhealth` and review every relevant warning/error - [x] Verify netrw can be loaded and `:Explore` opens the expected tree browser @@ -566,30 +566,30 @@ Proposed layout: ## Phase 13.7 — Validate the complete 0.12 candidate - [x] Validate startup, lazy loading, commands, and configured keymaps automatically -- [ ] Validate netrw tree browsing, previews, alternate-buffer behavior, and file operations +- [x] Validate netrw tree browsing, previews, alternate-buffer behavior, and file operations - [ ] Validate Telescope files, grep, buffers, and LSP symbol pickers -- [ ] Validate LSP attachment, `gd`, `gr`, `K`, diagnostics, and project-local `.nvim.lua` settings +- [x] Validate LSP attachment, `gd`, `gr`, `K`, diagnostics, and project-local `.nvim.lua` settings - [x] Validate the current completion stack before activation; native completion migration follows in Phase 13.9 -- [ ] Validate conform format-on-save and nvim-lint/Ruff diagnostics +- [x] Validate conform formatter availability and nvim-lint diagnostics; retain normal-use checks for save-time behavior - [x] Validate Treesitter parsers and custom HTML/CSS queries; retain interactive checks for highlighting, text objects, autotag, and folding - [ ] Validate the Paper Tonic colorscheme, plugin highlights, sessions, persistent undo, and shell templates -- [ ] Perform interactive smoke tests in the PHP validation workspace +- [x] Perform a PTY-backed PHP smoke test for native completion selection, acceptance, snippets, LSP settings, and diagnostics ## Phase 13.8 — Activate with rollback available -- [ ] Switch the active-version selector from 0.11.5 to 0.12.6 -- [ ] Repeat a short smoke test through the normal shell/PATH entrypoint -- [ ] Keep 0.11.5 and its rollback instructions available during a settling period -- [ ] Update AGENTS.md, README.md, and LOG.md with the final supported version and upgrade procedure +- [x] Switch the active-version selector from 0.11.5 to 0.12.6 +- [x] Repeat a short smoke test through the normal shell/PATH entrypoint +- [x] Keep 0.11.5 and its rollback instructions available during a settling period +- [x] Update AGENTS.md, README.md, and LOG.md with the final supported version and upgrade procedure - [ ] Remove 0.11.5 only after an explicit later decision ## Phase 13.9 — Consolidate on Neovim 0.12 native features - [x] Keep lazy.nvim as the plugin manager; do not combine the runtime upgrade with a migration to experimental `vim.pack` -- [ ] Replace `mbbill/undotree` with the optional native `nvim.undotree` package while preserving `u` -- [ ] Trial native automatic/LSP completion with explicit selection and built-in snippet expansion -- [ ] Enable Copilot inline suggestions with a distinct accept key and hide them while the native completion menu is visible +- [x] Replace `mbbill/undotree` with the optional native `nvim.undotree` package while preserving `u` +- [x] Configure native automatic/LSP completion with explicit selection and built-in snippet expansion for its settling trial +- [x] Enable Copilot inline suggestions with a distinct accept key and hide them while the native completion menu is visible - [ ] Validate PHP, HTML, JavaScript/TypeScript, Markdown, Lua, paths, snippets, autopairs, and Copilot interactively -- [ ] Remove nvim-cmp, cmp-nvim-lsp, cmp-buffer, cmp-path, LuaSnip, and copilot-cmp only after the native workflow passes -- [ ] Remove obsolete completion integrations, lockfile entries, highlights, and documentation +- [x] Remove nvim-cmp, cmp-nvim-lsp, cmp-buffer, cmp-path, LuaSnip, and copilot-cmp from the 0.12 candidate +- [x] Remove obsolete completion integrations, lockfile entries, highlights, and documentation ## Phase 13.10 — Update external tools separately - [ ] Review Mason package updates only after Neovim and plugin revisions are stable diff --git a/README.md b/README.md index e7765af..84840d2 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ Living reference for session management, keymaps, commands, and plugin-specific features in this config. +The active runtime is Neovim 0.12.6 through `~/.local/bin/nvim`. Neovim 0.11.5 remains available at `/opt/neovim/nvim-linux-x86_64/bin/nvim` for emergency rollback; the config starts there with 0.12-only native completion and Undotree disabled. + ## Session Management Session support is automatic but user-controlled: @@ -240,13 +242,13 @@ Buffer-local keymaps available when inside a git repository: | preview window | `` / `` | Scroll within UFO preview | | preview window | `[` / `]` | Jump to top/bottom of preview | -### Undotree `lua/plugins/undotree.lua` +### Native Undotree `lua/keymaps.lua` #### Keymaps | Mode | Key | Description | | --- | --- | --- | -| n | `u` | Toggle Undotree panel | +| n | `u` | Toggle Neovim's native Undotree panel (`:Undotree`) | ### Treesitter `lua/plugins/treesitter.lua` @@ -321,17 +323,33 @@ The configuration uses nvim-surround v4's default mappings. | normal | `cs{old}{new}` | Change surround | | normal | `cS{old}{new}` | Change surround (linewise) | -### Nvim-cmp (Completion) `lua/plugins/cmp.lua` +### Native Completion `lua/completion.lua` #### Keymaps | Mode | Key | Description | | --- | --- | --- | -| insert | `` | Manually trigger completion | -| insert | `` | Confirm the explicitly selected completion item | +| insert | `` | Manually trigger LSP completion | | insert | `` | Next completion item | | insert | `` | Previous completion item | -| insert | `` | Abort completion menu | +| insert | `` | Accept the explicitly selected completion item | +| insert | `` | Dismiss the completion menu | +| insert | `` | Complete words from the current buffer | +| insert | `` | Complete a filesystem path | +| insert/select | `` / `` | Jump forward/backward through native snippet tabstops | + +Completion opens automatically after a 150 ms delay, uses fuzzy matching, and does not preselect an item. LSP buffers prioritize language-aware results exclusively; buffer words remain available explicitly with ``. Buffers without an LSP autocomplete from a bounded set of nearby words. + +### Copilot Inline Suggestions `lua/plugins/copilot.lua` + +Copilot appears as ghost text rather than as an item in the native completion menu. Suggestions are hidden while that menu is visible. + +| Mode | Key | Description | +| --- | --- | --- | +| insert | `` | Accept the visible Copilot suggestion | +| insert | `` | Show the next Copilot suggestion | +| insert | `` | Show the previous Copilot suggestion | +| insert | `` | Dismiss the Copilot suggestion | ### Nvim-autopairs `lua/plugins/autopairs.lua` diff --git a/init.lua b/init.lua index 731f3bf..2990a84 100644 --- a/init.lua +++ b/init.lua @@ -4,6 +4,7 @@ vim.g.maplocalleader = ' ' -- Load basic settings, keymaps, autocmds (kept minimal for now) require('settings') +require('completion') require('netrw-config') require('keymaps') require('autocmds') @@ -29,3 +30,8 @@ require('lazy').setup({ enabled = false, }, }) + +-- Load optional native packages after lazy.nvim has finalized runtimepath. +if vim.fn.has('nvim-0.12') == 1 then + vim.cmd.packadd('nvim.undotree') +end diff --git a/lazy-lock.json b/lazy-lock.json index 4a547fe..6c39c14 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,11 +1,6 @@ { "Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" }, - "LuaSnip": { "branch": "master", "commit": "0abc8f390b278c3b4aabc4c004ac8a088b65cf24" }, - "cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" }, - "cmp-nvim-lsp": { "branch": "main", "commit": "cbc7b02bb99fae35cb42f514762b89b5126651ef" }, - "cmp-path": { "branch": "main", "commit": "c642487086dbd9a93160e1679a1327be111cbc25" }, "conform.nvim": { "branch": "master", "commit": "016802de402556da54c36bd7359b441266b01cdd" }, - "copilot-cmp": { "branch": "master", "commit": "15fc12af3d0109fa76b60b5cffa1373697e261d1" }, "copilot.lua": { "branch": "master", "commit": "82607bbb8528222a9a28bfcab0aceb3a7fed7e85" }, "gitsigns.nvim": { "branch": "main", "commit": "d4854fa9a94b5c8b37dd209fb4a19e98e764186f" }, "indent-blankline.nvim": { "branch": "master", "commit": "f1e186e44d3b7f9ae918008e2c28ce37c6023d2d" }, @@ -14,17 +9,15 @@ "mason-tool-installer.nvim": { "branch": "main", "commit": "443f1ef8b5e6bf47045cb2217b6f748a223cf7dc" }, "mason.nvim": { "branch": "main", "commit": "2a6940af80375532e5e9e7c1f2fc6319a1b7a69d" }, "nvim-autopairs": { "branch": "master", "commit": "3172f40c16563db871a58f20d205c710ad782311" }, - "nvim-cmp": { "branch": "main", "commit": "2ffe79f1f021def8dd1fcd81deb16f1bb0d989f3" }, "nvim-lint": { "branch": "master", "commit": "f6230a5c06ba59e6059c14637f1dbe29a7978b9b" }, "nvim-lspconfig": { "branch": "master", "commit": "3bccb6fa49a3a75bfb6d92fed63b13a71a85cfaf" }, "nvim-surround": { "branch": "main", "commit": "2e93e154de9ff326def6480a4358bfc149d5da2c" }, - "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, + "nvim-treesitter": { "branch": "master", "commit": "cf12346a3414fa1b06af75c79faebe7f76df080a" }, "nvim-treesitter-textobjects": { "branch": "master", "commit": "5ca4aaa6efdcc59be46b95a3e876300cfead05ef" }, "nvim-ts-autotag": { "branch": "main", "commit": "d7220b55e16ed3c04e88086256def5d282429493" }, "nvim-ufo": { "branch": "main", "commit": "ab3eb124062422d276fae49e0dd63b3ad1062cfc" }, "plenary.nvim": { "branch": "master", "commit": "74b06c6c75e4eeb3108ec01852001636d85a932b" }, "promise-async": { "branch": "main", "commit": "119e8961014c9bfaf1487bf3c2a393d254f337e2" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "b25b749b9db64d375d782094e2b9dce53ad53a40" }, - "telescope.nvim": { "branch": "0.1.x", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }, - "undotree": { "branch": "master", "commit": "6fa6b57cda8459e1e4b2ca34df702f55242f4e4d" } + "telescope.nvim": { "branch": "0.1.x", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" } } diff --git a/lua/completion.lua b/lua/completion.lua new file mode 100644 index 0000000..8e77363 --- /dev/null +++ b/lua/completion.lua @@ -0,0 +1,13 @@ +-- Neovim 0.12 native insert-mode completion. +if vim.fn.has("nvim-0.12") == 0 then + return +end + +vim.opt.autocomplete = true +vim.opt.autocompletedelay = 150 +vim.opt.completeopt = { "menu", "menuone", "noselect", "popup", "fuzzy" } +vim.opt.complete = { ".^10", "w^5", "b^5", "u^5" } + +vim.keymap.set("i", "", function() + vim.lsp.completion.get() +end, { desc = "Completion: Trigger LSP suggestions", silent = true }) diff --git a/lua/keymaps.lua b/lua/keymaps.lua index afc1b59..beba015 100644 --- a/lua/keymaps.lua +++ b/lua/keymaps.lua @@ -9,6 +9,11 @@ local map = vim.keymap.set +-- Neovim 0.12's optional native undo-tree viewer. +if vim.fn.has('nvim-0.12') == 1 then + map('n', 'u', 'Undotree', { desc = 'Undotree: Toggle native undo tree', silent = true }) +end + -- Fallback navigation keymaps for non-LSP buffers -- When LSP attaches, buffer-local keymaps in lsp.lua override these map('n', 'gd', function() diff --git a/lua/paper-tonic-modern/groups/plugins.lua b/lua/paper-tonic-modern/groups/plugins.lua index c231b28..e98364d 100644 --- a/lua/paper-tonic-modern/groups/plugins.lua +++ b/lua/paper-tonic-modern/groups/plugins.lua @@ -1,5 +1,5 @@ -- Paper Tonic Modern - Plugin Highlight Groups --- Highlights for configured plugins (Telescope, Gitsigns, cmp, etc.) +-- Highlights for configured plugins (Telescope, Gitsigns, etc.) local c = require('paper-tonic-modern.colors') @@ -58,44 +58,6 @@ return { GitSignsChangeInline = { bg = c.bg_hl_special }, GitSignsDeleteInline = { bg = c.bg_error_weak }, - -- ============================================================================ - -- nvim-cmp (completion menu) - -- ============================================================================ - - -- Menu - CmpItemAbbr = { fg = c.fg }, - CmpItemAbbrMatch = { fg = c.primary, bold = true }, - CmpItemAbbrMatchFuzzy = { fg = c.primary_weak }, - CmpItemAbbrDeprecated = { fg = c.fg_weak, strikethrough = true }, - CmpItemMenu = { fg = c.fg_weak, italic = true }, - - -- Kind icons/labels - CmpItemKindDefault = { fg = c.fg }, - CmpItemKindVariable = { fg = c.fg }, - CmpItemKindFunction = { fg = c.primary_weak }, - CmpItemKindMethod = { fg = c.primary_weak }, - CmpItemKindConstructor = { fg = c.primary }, - CmpItemKindClass = { fg = c.primary_strong }, - CmpItemKindInterface = { fg = c.primary_strong }, - CmpItemKindStruct = { fg = c.primary_strong }, - CmpItemKindProperty = { fg = c.fg_strong }, - CmpItemKindField = { fg = c.fg_strong }, - CmpItemKindEnum = { fg = c.primary }, - CmpItemKindEnumMember = { fg = c.fg_strong }, - CmpItemKindModule = { fg = c.primary }, - CmpItemKindKeyword = { fg = c.primary_weak }, - CmpItemKindSnippet = { fg = c.modified }, - CmpItemKindText = { fg = c.fg }, - CmpItemKindFile = { fg = c.fg }, - CmpItemKindFolder = { fg = c.fg_strong }, - CmpItemKindColor = { fg = c.diag_warn }, - CmpItemKindUnit = { fg = c.fg_weak }, - CmpItemKindValue = { fg = c.fg_strong }, - CmpItemKindConstant = { fg = c.fg_strong }, - CmpItemKindReference = { fg = c.modified }, - CmpItemKindOperator = { fg = c.fg }, - CmpItemKindTypeParameter = { fg = c.primary }, - -- ============================================================================ -- Comment.nvim -- ============================================================================ diff --git a/lua/paper-tonic-modern/init.lua b/lua/paper-tonic-modern/init.lua index b610d88..fbd9e58 100644 --- a/lua/paper-tonic-modern/init.lua +++ b/lua/paper-tonic-modern/init.lua @@ -130,7 +130,7 @@ function M.load() local lsp = require('paper-tonic-modern.groups.lsp') M.highlight_all(lsp) - -- Plugin highlights (Telescope, Gitsigns, cmp, etc.) + -- Plugin highlights (Telescope, Gitsigns, etc.) local plugins = require('paper-tonic-modern.groups.plugins') M.highlight_all(plugins) diff --git a/lua/plugins/autopairs.lua b/lua/plugins/autopairs.lua index cc104e4..3c85e62 100644 --- a/lua/plugins/autopairs.lua +++ b/lua/plugins/autopairs.lua @@ -25,9 +25,5 @@ return { }, }) - -- Integration with nvim-cmp - local cmp_autopairs = require('nvim-autopairs.completion.cmp') - local cmp = require('cmp') - cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done()) end, } diff --git a/lua/plugins/cmp.lua b/lua/plugins/cmp.lua deleted file mode 100644 index 03702bd..0000000 --- a/lua/plugins/cmp.lua +++ /dev/null @@ -1,69 +0,0 @@ -return { - "hrsh7th/nvim-cmp", - event = "InsertEnter", - dependencies = { - "hrsh7th/cmp-nvim-lsp", - "hrsh7th/cmp-buffer", - "hrsh7th/cmp-path", - "L3MON4D3/LuaSnip", - "zbirenbaum/copilot-cmp", -- Copilot completion source - }, - opts = function() - local cmp = require("cmp") - local luasnip = require("luasnip") - - return { - snippet = { - expand = function(args) - luasnip.lsp_expand(args.body) - end, - }, - mapping = cmp.mapping.preset.insert({ - [""] = cmp.mapping.complete(), - [""] = cmp.mapping.confirm({ select = false }), - [""] = cmp.mapping.select_next_item(), - [""] = cmp.mapping.select_prev_item(), - [""] = cmp.mapping.abort(), - }), - sources = cmp.config.sources({ - { name = "copilot", group_index = 2 }, -- Copilot suggestions (priority 1) - { name = "nvim_lsp", group_index = 2 }, - { name = "path", group_index = 2 }, - { name = "buffer", group_index = 2 }, - }), - preselect = cmp.PreselectMode.None, - completion = { completeopt = "menu,menuone,noinsert,noselect" }, - window = { - completion = cmp.config.window.bordered({ - border = { - { "🭽", "FloatBorder" }, - { "▔", "FloatBorder" }, - { "🭾", "FloatBorder" }, - { "▕", "FloatBorder" }, - { "🭿", "FloatBorder" }, - { "▁", "FloatBorder" }, - { "🭼", "FloatBorder" }, - { "▏", "FloatBorder" }, - }, - winhighlight = "Normal:Normal,FloatBorder:FloatBorder,CursorLine:PmenuSel", - }), - documentation = cmp.config.window.bordered({ - border = { - { "🭽", "FloatBorder" }, - { "▔", "FloatBorder" }, - { "🭾", "FloatBorder" }, - { "▕", "FloatBorder" }, - { "🭿", "FloatBorder" }, - { "▁", "FloatBorder" }, - { "🭼", "FloatBorder" }, - { "▏", "FloatBorder" }, - }, - winhighlight = "Normal:Normal,FloatBorder:FloatBorder", - }), - }, - } - end, - config = function(_, opts) - require("cmp").setup(opts) - end, -} diff --git a/lua/plugins/copilot.lua b/lua/plugins/copilot.lua index 87337d7..95aaba6 100644 --- a/lua/plugins/copilot.lua +++ b/lua/plugins/copilot.lua @@ -1,22 +1,23 @@ --- GitHub Copilot: AI-powered code completion +-- GitHub Copilot inline suggestions, separate from the native completion menu. return { - { - 'zbirenbaum/copilot.lua', - cmd = 'Copilot', - event = 'InsertEnter', -- Lazy load on first insert mode entry - opts = { - suggestion = { enabled = false }, -- Disable inline suggestions (use cmp instead) - panel = { enabled = false }, -- Disable panel (use cmp instead) - filetypes = { - ['*'] = true, -- Enable for all filetypes + 'zbirenbaum/copilot.lua', + cmd = 'Copilot', + event = 'InsertEnter', + opts = { + suggestion = { + enabled = true, + auto_trigger = true, + hide_during_completion = true, + keymap = { + accept = '', + next = '', + prev = '', + dismiss = '', }, }, - }, - { - 'zbirenbaum/copilot-cmp', - dependencies = { 'zbirenbaum/copilot.lua' }, - config = function() - require('copilot_cmp').setup() - end, + panel = { enabled = false }, + filetypes = { + ['*'] = true, + }, }, } diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua index 263705a..afbfb9f 100644 --- a/lua/plugins/lsp.lua +++ b/lua/plugins/lsp.lua @@ -1,12 +1,7 @@ return { "neovim/nvim-lspconfig", event = { "BufReadPre", "BufNewFile" }, - dependencies = { - "hrsh7th/cmp-nvim-lsp", - }, config = function() - local capabilities = require("cmp_nvim_lsp").default_capabilities() - -- Load trusted project-local LSP settings from .nvim.lua. local function load_project_lsp_settings(server_name, root_dir) if not root_dir then @@ -66,6 +61,13 @@ return { -- Setup keymaps for this buffer setup_keymaps(args.buf) + if client:supports_method("textDocument/completion") then + vim.lsp.completion.enable(true, client.id, args.buf) + if vim.fn.has("nvim-0.12") == 1 then + vim.bo[args.buf].complete = "o^20" + end + end + -- Load and send project-specific settings local project_settings = load_project_lsp_settings(client.name, client.root_dir) if project_settings.settings then @@ -88,13 +90,8 @@ return { local function configure(server_name, opts) opts = opts or {} - -- Merge with defaults - local config = vim.tbl_deep_extend("force", { - capabilities = capabilities, - }, opts) - -- Configure the server using the new API - vim.lsp.config(server_name, config) + vim.lsp.config(server_name, opts) end -- Configure all servers diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua index 1fedd0c..f08bbde 100644 --- a/lua/plugins/treesitter.lua +++ b/lua/plugins/treesitter.lua @@ -131,19 +131,19 @@ return { -- Setup autotag require("nvim-ts-autotag").setup({ opts = { - enable_close = true, -- Auto close tags - enable_rename = true, -- Auto rename pairs of tags - enable_close_on_slash = true, -- Auto close on trailing u', 'UndotreeToggle', desc = 'Undotree: Toggle undo tree' }, - }, - config = function() - -- Configure undotree - vim.g.undotree_WindowLayout = 2 -- Layout: diff at bottom - vim.g.undotree_ShortIndicators = 1 -- Use short time indicators - vim.g.undotree_SetFocusWhenToggle = 1 -- Focus undotree when toggled - vim.g.undotree_DiffAutoOpen = 1 -- Auto open diff window - end, -} diff --git a/lua/settings.lua b/lua/settings.lua index 73d3fb4..ac855db 100644 --- a/lua/settings.lua +++ b/lua/settings.lua @@ -65,14 +65,8 @@ vim.opt.tabline = '%!v:lua.require("utils").custom_tabline()' vim.opt.showtabline = 1 -- Show tabline only when there are 2+ tabs -- Phase 3.2: non-plugin settings (legacy values where specified) --- Completion UI for nvim-cmp -vim.opt.completeopt = { "menu", "menuone", "noselect" } - --- Built-in completion popup style (for Ctrl-X Ctrl-N/F completions) --- Use floating window with border for native completion +-- Native completion popup style vim.opt.pumblend = 0 -- No transparency --- Note: Native completion (pumvisible) doesn't support custom borders like LSP floats --- The Pmenu* highlight groups control its appearance -- Spelling vim.opt.spell = true diff --git a/neovim-migration-guide.md b/neovim-migration-guide.md index 5d062a5..4af4ead 100644 --- a/neovim-migration-guide.md +++ b/neovim-migration-guide.md @@ -1,5 +1,7 @@ # ✔ **Neovim Migration Guide for AI Assistance** +> **Historical planning input:** this document records the migration's original assumptions and is not an active specification. `AGENTS.md`, `README.md`, `MIGRATION_PLAN.md`, and `LOG.md` describe the current netrw-only, native-completion architecture and supersede conflicting requirements below. + ## **Purpose** I am transitioning from VS Code back to Neovim.