This plugin, supermaven-nvim, lets you use Supermaven in Neovim. If you encounter any issues while using supermaven-nvim, consider opening an issue or reaching out to us on Discord.
Using a plugin manager, run the .setup({}) function in your Neovim configuration file.
Using lazy.nvim
require("lazy").setup({
{
"supermaven-inc/supermaven-nvim",
config = function()
require("supermaven-nvim").setup({})
end,
},
}, {})Using packer.nvim
use {
"supermaven-inc/supermaven-nvim",
config = function()
require("supermaven-nvim").setup({})
end,
}By default, supermaven-nvim will use the <Tab> and <C-]> keymaps to accept and clear suggestions. You can change these keymaps by passing a keymaps table to the .setup({}) function. Also in this table is accept_word, which allows partially accepting a completion, up to the end of the next word. By default this keymap is set to <C-j>.
The ignore_filetypes table is used to ignore filetypes when using supermaven-nvim. If a filetype is present as a key, and its value is true, supermaven-nvim will not display suggestions for that filetype.
suggestion_color and cterm options can be used to set the color of the suggestion text.
require("supermaven-nvim").setup({
keymaps = {
accept_suggestion = "<Tab>",
clear_suggestion = "<C-]>",
accept_word = "<C-j>",
},
ignore_filetypes = { cpp = true },
color = {
suggestion_color = "#ffffff",
cterm = 244,
},
disable_inline_completion = false, -- disables inline completion for use with cmp
disable_keymaps = false -- disables built in keymaps for more manual control
})If you are using nvim-cmp, you can use the supermaven source (which is registered by default) by adding the following to your cmp.setup() function:
-- cmp.lua
cmp.setup {
...
sources = {
{ name = "supermaven" },
}
...
}It also has a builtin highlight group CmpItemKindSupermaven. To add an icon to Supermaven for lspkind, simply add Supermaven to your lspkind symbol map.
-- lspkind.lua
local lspkind = require("lspkind")
lspkind.init({
symbol_map = {
Supermaven = "",
},
})
vim.api.nvim_set_hl(0, "CmpItemKindSupermaven", {fg ="#6CC644"})Alternatively, you can add Supermaven to the lspkind symbol_map within the cmp format function.
-- cmp.lua
cmp.setup {
...
formatting = {
format = lspkind.cmp_format({
mode = "symbol",
max_width = 50,
symbol_map = { Supermaven = "" }
})
}
...
}Alternatively, you can also check if there is an active suggestion and accept it programatically.
For example:
require("supermaven-nvim").setup({
disable_keymaps = true
})
...
M.expand = function(fallback)
local luasnip = require('luasnip')
local suggestion = require('supermaven-nvim.completion_preview')
if luasnip.expandable() then
luasnip.expand()
elseif suggestion.has_suggestion() then
suggestion.on_accept_suggestion()
else
fallback()
end
endUpon starting supermaven-nvim, you will be prompted to either use the Free Tier with the command :SupermavenUseFree or to activate a Supermaven Pro subscription by following a link, which will connect your Supermaven account.
If Supermaven is set up, you can use :SupermavenLogout to switch versions.