-- Supermaven sends buffer context to a third party, so no machine gets it -- unless it asks: export DOT_SUPERMAVEN=1, in ~/.localenv on the machines that -- want it. Off, `enabled = false` keeps the plugins off disk entirely, which -- matters because the `condition` option below is supermaven-nvim's own and -- reads the other way round -- `true` STOPS it, so the `return false` there -- left it running on every machine, agent and inline suggestions included. local supermaven_enabled = vim.env.DOT_SUPERMAVEN == "1" 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 supermaven, where that machine opted in -- see the top) default = supermaven_enabled and { "lazydev", "lsp", "path", "snippets", "buffer", "supermaven" } or { "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 = supermaven_enabled, 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", enabled = supermaven_enabled, 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", enabled = supermaven_enabled, }, -- 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