diff --git a/init.lua b/init.lua index 9098348..4249c28 100644 --- a/init.lua +++ b/init.lua @@ -30,6 +30,15 @@ vim.opt.sidescrolloff = 8 vim.opt.mouse = 'a' vim.opt.autochdir = false vim.opt.clipboard = 'unnamed,unnamedplus' +in_wsl = os.getenv('WSL_DISTRO_NAME') ~= nil +if in_wsl then + vim.g.clipboard = { + name = 'wsl clipboard', + copy = { ["+"] = { "clip.exe" }, ["*"] = { "clip.exe" } }, + paste = { ["+"] = { "win32yank.exe" }, ["*"] = { "win32yank.exe" } }, + cache_enabled = true + } +end vim.opt.number = true vim.opt.wrap = false vim.opt.signcolumn = 'yes:2' diff --git a/lazy-lock.json b/lazy-lock.json index bda530e..0b28263 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -17,6 +17,7 @@ "lunar.nvim": { "branch": "master", "commit": "08bbc93b96ad698d22fc2aa01805786bcedc34b9" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "3856bbb0da214d1f2f3d5a2dd3fea26591f930f9" }, "mason.nvim": { "branch": "main", "commit": "9eaedb864cdadc29c6eb7d761a6c0d8aee26c91b" }, + "minuet-ai.nvim": { "branch": "main", "commit": "0d4464076216c4f46a54d44034bfd5c2284d0a32" }, "nvim-autopairs": { "branch": "master", "commit": "4d74e75913832866aa7de35e4202463ddf6efd1b" }, "nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" }, "nvim-dap": { "branch": "master", "commit": "b0f983507e3702f073bfe1516846e58b56d4e42f" }, @@ -29,8 +30,10 @@ "nvim-treesitter-context": { "branch": "master", "commit": "4976d8b90401cba9b85f6861e4e5a6edef2f2086" }, "nvim-treesitter-textobjects": { "branch": "master", "commit": "0f051e9813a36481f48ca1f833897210dbcfffde" }, "nvim-web-devicons": { "branch": "master", "commit": "1fb58cca9aebbc4fd32b086cb413548ce132c127" }, + "opencode.nvim": { "branch": "main", "commit": "c8e40fdaa158a44b8ca075a76816b85a64452fdb" }, "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, "rustaceanvim": { "branch": "master", "commit": "047f9c9d8cd2861745eb9de6c1570ee0875aa795" }, + "snacks.nvim": { "branch": "main", "commit": "bc0630e43be5699bb94dadc302c0d21615421d93" }, "telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" }, "telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }, "trouble.nvim": { "branch": "main", "commit": "85bedb7eb7fa331a2ccbecb9202d8abba64d37b3" }, diff --git a/lua/plugins/ai.lua b/lua/plugins/ai.lua new file mode 100644 index 0000000..5dc9a1f --- /dev/null +++ b/lua/plugins/ai.lua @@ -0,0 +1,42 @@ +return { + { + 'NickvanDyke/opencode.nvim', + dependencies = { 'folke/snacks.nvim', }, + ---@type opencode.Config + opts = { + -- Your configuration, if any + }, + -- stylua: ignore + keys = { + { 'ot', function() require('opencode').toggle() end, desc = 'Toggle embedded opencode', }, + { 'oa', function() require('opencode').ask() end, desc = 'Ask opencode', mode = 'n', }, + { 'oa', function() require('opencode').ask('@selection: ') end, desc = 'Ask opencode about selection', mode = 'v', }, + { 'op', function() require('opencode').select_prompt() end, desc = 'Select prompt', mode = { 'n', 'v', }, }, + { 'on', function() require('opencode').command('session_new') end, desc = 'New session', }, + { 'oy', function() require('opencode').command('messages_copy') end, desc = 'Copy last message', }, + { '', function() require('opencode').command('messages_half_page_up') end, desc = 'Scroll messages up', }, + { '', function() require('opencode').command('messages_half_page_down') end, desc = 'Scroll messages down', }, + }, + }, + { + 'milanglacier/minuet-ai.nvim', + dependencies = { 'hrsh7th/nvim-cmp', 'nvim-lua/plenary.nvim' }, + config = function() + require('minuet').setup { + -- Your configuration options here + provider_options = { + codestral = { + model = 'codestral-latest', + end_point = 'https://codestral.mistral.ai/v1/fim/completions', + api_key = 'CODESTRAL_API_KEY', + stream = true, + optional = { + stop = { '\n\n' }, -- the identifier to stop the completion generation + max_tokens = 256, + }, + }, + } + } + end, + }, +} diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua index 21cb435..58453a3 100644 --- a/lua/plugins/lsp.lua +++ b/lua/plugins/lsp.lua @@ -375,7 +375,15 @@ return { { name = 'nvim_lsp_signature_help' }, }, { { name = 'buffer', keyword_length = 5 }, + { name = 'minuet' }, }), + performance = { + -- It is recommended to increase the timeout duration due to + -- the typically slower response speed of LLMs compared to + -- other completion sources. This is not needed when you only + -- need manual completion. + fetching_timeout = 2000, + }, formatting = { format = lspkind.cmp_format { with_text = true, @@ -385,6 +393,7 @@ return { nvim_lua = "[api]", path = "[path]", luasnip = "[snip]", + minuet = "[llm]", } } }