Skip to content

Instantly share code, notes, and snippets.

@ArcHound
Created April 18, 2025 12:54
Show Gist options
  • Save ArcHound/86d6b6ab3e1f0b503d4825bcc29b78aa to your computer and use it in GitHub Desktop.
Save ArcHound/86d6b6ab3e1f0b503d4825bcc29b78aa to your computer and use it in GitHub Desktop.
Neovim init.lua
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
if vim.v.shell_error ~= 0 then
vim.api.nvim_echo({
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
{ out, "WarningMsg" },
{ "\nPress any key to exit..." },
}, true, {})
vim.fn.getchar()
os.exit(1)
end
end
vim.opt.rtp:prepend(lazypath)
-- Make sure to setup `mapleader` and `maplocalleader` before
-- loading lazy.nvim so that mappings are correct.
-- This is also a good place to setup other settings (vim.opt)
vim.g.mapleader = " "
vim.g.maplocalleader = "\\"
vim.g.have_nerd_font = true
-- Setup lazy.nvim
require("lazy").setup({
-- colorscheme that will be used when installing plugins.
spec = {
-- add your plugins here
{ "EdenEast/nightfox.nvim" },
{ "folke/tokyonight.nvim" },
{ 'milanglacier/minuet-ai.nvim' },
{ 'nvim-lua/plenary.nvim' },
{ 'Saghen/blink.cmp',
version = '*',
build = 'cargo build --release'
},
{ 'nvim-lualine/lualine.nvim',
},
{ "olimorris/codecompanion.nvim",
opts = {},
},
{ "OXY2DEV/markview.nvim",
lazy = false, -- Recommended
},
{"nvim-treesitter/nvim-treesitter", build = ":TSUpdate"},
{ "nvim-tree/nvim-web-devicons", opts = {} }
},
-- Configure any other settings here. See the documentation for more details.
-- automatically check for plugin updates
install = {
colorscheme = {"tokyonight"},
},
checker = { enabled = true },
})
require('minuet').setup {
-- Enable or disable auto-completion. Note that you still need to add
-- Minuet to your cmp/blink sources. This option controls whether cmp/blink
-- will attempt to invoke minuet when minuet is included in cmp/blink
-- sources. This setting has no effect on manual completion; Minuet will
-- always be enabled when invoked manually. You can use the command
-- `Minuet cmp/blink toggle` to toggle this option.
blink = {
enable_auto_complete = true,
},
provider = 'codestral',
-- the maximum total characters of the context before and after the cursor
-- 16000 characters typically equate to approximately 4,000 tokens for
-- LLMs.
context_window = 16000,
-- when the total characters exceed the context window, the ratio of
-- context before cursor and after cursor, the larger the ratio the more
-- context before cursor will be used. This option should be between 0 and
-- 1, context_ratio = 0.75 means the ratio will be 3:1.
context_ratio = 0.75,
throttle = 1000, -- only send the request every x milliseconds, use 0 to disable throttle.
-- debounce the request in x milliseconds, set to 0 to disable debounce
debounce = 400,
-- Control notification display for request status
-- Notification options:
-- false: Disable all notifications (use boolean false, not string "false")
-- "debug": Display all notifications (comprehensive debugging)
-- "verbose": Display most notifications
-- "warn": Display warnings and errors only
-- "error": Display errors only
notify = 'warn',
-- The request timeout, measured in seconds. When streaming is enabled
-- (stream = true), setting a shorter request_timeout allows for faster
-- retrieval of completion items, albeit potentially incomplete.
-- Conversely, with streaming disabled (stream = false), a timeout
-- occurring before the LLM returns results will yield no completion items.
request_timeout = 3,
-- If completion item has multiple lines, create another completion item
-- only containing its first line. This option only has impact for cmp and
-- blink. For virtualtext, no single line entry will be added.
add_single_line_entry = false,
-- The number of completion items encoded as part of the prompt for the
-- chat LLM. For FIM model, this is the number of requests to send. It's
-- important to note that when 'add_single_line_entry' is set to true, the
-- actual number of returned items may exceed this value. Additionally, the
-- LLM cannot guarantee the exact number of completion items specified, as
-- this parameter serves only as a prompt guideline.
n_completions = 3,
-- Defines the length of non-whitespace context after the cursor used to
-- filter completion text. Set to 0 to disable filtering.
--
-- Example: With after_cursor_filter_length = 3 and context:
--
-- "def fib(n):\n|\n\nfib(5)" (where | represents cursor position),
--
-- if the completion text contains "fib", then "fib" and subsequent text
-- will be removed. This setting filters repeated text generated by the
-- LLM. A large value (e.g., 15) is recommended to avoid false positives.
after_cursor_filter_length = 15,
-- proxy port to use
proxy = nil,
provider_options = {
-- see the documentation in each provider in the following part.
codestral = {
api_key = 'CODESTRAL_KEY',
},
},
-- see the documentation in the `Prompt` section
-- Config options for `Minuet change_preset` command
presets = {}
}
require("codecompanion").setup {
adapters = {
mistral = function()
return require("codecompanion.adapters").extend("mistral", {
env = {
api_key = "MISTRAL_AI_KEY",
url = "https://api.mistral.ai"
},
schema = {
model = {
default = "codestral-latest"
}
}
})
end,
},
strategies = {
chat = {
adapter = "mistral",
},
inline = {
adapter = "mistral",
},
},
}
require('blink-cmp').setup {
keymap = {
-- Manually invoke minuet completion.
['<A-y>'] = require('minuet').make_blink_map(),
},
sources = {
-- Enable minuet for autocomplete
default = { 'lsp', 'path', 'buffer', 'snippets', 'minuet', 'codecompanion' },
-- For manual completion only, remove 'minuet' from default
providers = {
minuet = {
name = 'minuet',
module = 'minuet.blink',
score_offset = 8, -- Gives minuet higher priority among suggestions
},
},
},
signature = { enabled = true },
-- Recommended to avoid unnecessary request
completion = { trigger = { prefetch_on_insert = false } },
}
require('lualine').setup {
options = {
theme = "iceberg_dark",
},
sections = {
lualine_x = {
require('minuet.lualine'),
'encoding',
'fileformat',
'filetype',
},
},
}
vim.cmd("colorscheme tokyonight")
local presets = require("markview.presets")
require("markview").setup({
preview = {
enable = true,
filetypes = {
'md',
'markdown',
'norg',
'rmd',
'org',
'vimwiki',
'typst',
'latex',
'quarto',
'Avante',
'codecompanion',
},
-- debounce = 50,
-- modes = { 'n', 'i', 'c', ':', 'no', 'io', 'co' },
-- hybrid_modes = { 'i', 'n' },
-- inlines = true,
-- commands = true,
}
})
vim.api.nvim_create_autocmd('FileType', {
pattern = 'codecompanion',
command = 'Markview attach',
})
vim.cmd("colorscheme tokyonight")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment