From 13cc065ec014b86369dfe4ad60d1a43fa06fd251 Mon Sep 17 00:00:00 2001 From: Igor Soarez Date: Thu, 17 Sep 2026 19:45:23 +0100 Subject: dotfiles Shell, editor and terminal configuration, the tools that go with them, and szecret, an age-based secret manager whose store lives elsewhere. History restarts here. What came before was not written to be read by anyone else, and carried machine names, addresses and an encrypted secret store; it is kept privately instead. What is left is meant to be safe on any machine, including one whose owner is not me: see CLAUDE.md for the rule it is written to. --- config/nvim/lua/plugins/completion.lua | 159 +++++++++++++++++++++++++++++++++ 1 file changed, 159 insertions(+) create mode 100644 config/nvim/lua/plugins/completion.lua (limited to 'config/nvim/lua/plugins/completion.lua') diff --git a/config/nvim/lua/plugins/completion.lua b/config/nvim/lua/plugins/completion.lua new file mode 100644 index 0000000..fa037cd --- /dev/null +++ b/config/nvim/lua/plugins/completion.lua @@ -0,0 +1,159 @@ +local plugins = { + -- Autocompletion and Snippets + { + "Saghen/blink.cmp", + version = "1.*", -- Use a stable release version + main = "blink.cmp", + opts = { + keymap = { -- https://cmp.saghen.dev/configuration/keymap.html + preset = "default", + [""] = { "accept", "fallback" }, + }, + sources = { + -- Enable completion from lazydev, LSP, filesystem paths, snippets, buffer + -- (and optionally supermaven) + -- default = { "lazydev", "lsp", "path", "snippets", "buffer", "supermaven" }, + default = { "lazydev", "lsp", "path", "snippets", "buffer" }, + providers = { + -- Neovim Lua API / plugin spec completions (folke/lazydev.nvim) + lazydev = { + name = "LazyDev", + module = "lazydev.integrations.blink", + score_offset = 100, -- show lazydev items above LSP + }, + buffer = { + -- Optional: Configure buffer-specific settings + -- max_async_buffer_size = 200000, -- 200KB default + -- use_cache = true, -- Cache words for better performance + }, + -- lsp = { fallbacks = {} }, -- always show the buffer source + supermaven = { + enabled = false, + name = "supermaven", + module = "blink-cmp-supermaven", + async = true, + + }, + }, + }, + completion = { + -- Enable ghost text to show completions inline + ghost_text = { + -- enabled = true, + enabled = false, + }, + -- Configure the completion menu + menu = { + auto_show = true, -- Automatically show the menu + }, + list = { + selection = { + preselect = true, + auto_insert = false, + }, + }, + -- Avoid unnecessary requests for performance + trigger = { + -- prefetch_on_insert = true, -- When true, will prefetch the completion items when entering insert mode + show_in_snippet = false, -- When false, will not show the completion window automatically when in a snippet + show_on_backspace = false, -- When true, will show completion window after backspacing + show_on_backspace_in_keyword = false, -- When true, will show completion window after backspacing into a keyword + show_on_backspace_after_accept = false, -- When true, will show the completion window after accepting a completion and then backspacing into a keyword + show_on_backspace_after_insert_enter = false, -- When true, will show the completion window after entering insert mode and backspacing into keyword + show_on_keyword = false, -- When true, will show the completion window after typing any of alphanumerics, `-` or `_` + show_on_trigger_character = false, -- When true, will show the completion window after typing a trigger character + show_on_insert = false, -- When true, will show the completion window after entering insert mode + -- LSPs can indicate when to show the completion window via trigger characters + -- however, some LSPs (i.e. tsserver) return characters that would essentially + -- always show the window. We block these by default. + -- show_on_blocked_trigger_characters = { " ", "\n", "\t" }, + -- You can also block per filetype with a function: + -- show_on_blocked_trigger_characters = function(ctx) + -- if vim.bo.filetype == 'markdown' then return { ' ', '\n', '\t', '.', '/', '(', '[' } end + -- return { ' ', '\n', '\t' } + -- end, + -- When both this and show_on_trigger_character are true, will show the completion window + -- when the cursor comes after a trigger character after accepting an item + show_on_accept_on_trigger_character = false, + -- When both this and show_on_trigger_character are true, will show the completion window + -- when the cursor comes after a trigger character when entering insert mode + show_on_insert_on_trigger_character = false, + -- List of trigger characters (on top of `show_on_blocked_trigger_characters`) that won't trigger + -- the completion window when the cursor comes after a trigger character when + -- entering insert mode/accepting an item + -- show_on_x_blocked_trigger_characters = { "'", '"', "(" }, + -- or a function, similar to show_on_blocked_trigger_character + }, + }, + signature = { + enabled = true, + window = { + show_documentation = false, + }, + }, + -- Disable blink.cmp for command-line mode to let native wildmenu work + cmdline = { + enabled = false, + }, + }, + }, + + -- Supermaven was acquired (and killed) by Cursor + { + "supermaven-inc/supermaven-nvim", + event = "InsertEnter", + opts = { + keymaps = { + accept_suggestion = "", + clear_suggestion = "", + accept_word = "", + }, + ignore_filetypes = {}, + disable_inline_completion = false, + disable_keymaps = false, + condition = function() + return false + end, + log_level = "info", + }, + config = function(_, opts) + require("supermaven-nvim").setup(opts) + -- Clear supermaven ghost text when entering command-line mode + -- to prevent interference with wildmenu completion + vim.api.nvim_create_autocmd("CmdlineEnter", { + callback = function() + local ok, preview = pcall(require, "supermaven-nvim.completion_preview") + if ok and preview.on_dispose_inlay then + preview.on_dispose_inlay() + end + end, + }) + end, + }, + { + "huijiro/blink-cmp-supermaven", + }, + + -- Lua LSP completion + types for the Neovim API and lazy plugin specs. + -- Replaces the old lua_ls `globals` hack for editing this config. + { + "folke/lazydev.nvim", + ft = "lua", + opts = { + library = { + -- Load luvit types when the `vim.uv` word is found + { path = "${3rd}/luv/library", words = { "vim%.uv" } }, + -- Types for snacks.nvim (used throughout this config) + { path = "snacks.nvim", words = { "Snacks" } }, + }, + }, + }, +} + +for _, plugin in ipairs(plugins) do + if not plugin.priority then + plugin.priority = 2000 + end +end + +return plugins -- cgit v1.2.3