Skip to content

Commit 4eac188

Browse files
committed
feat: add opencode alias and agent, commands
1 parent f79d9dc commit 4eac188

26 files changed

Lines changed: 2795 additions & 158 deletions

.config/nvim/lazy-lock.json

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,25 @@
11
{
2-
"claude-code.nvim": { "branch": "main", "commit": "c9a31e51069977edaad9560473b5d031fcc5d38b" },
3-
"codecompanion.nvim": { "branch": "main", "commit": "99448f47c3e23a06009ac176ba4c785e162d9c10" },
4-
"cyberdream.nvim": { "branch": "main", "commit": "f660ebfd8840e226d2a5368e08108a7aa84fef36" },
5-
"fidget.nvim": { "branch": "main", "commit": "d9ba6b7bfe29b3119a610892af67602641da778e" },
2+
"cyberdream.nvim": { "branch": "main", "commit": "89fd0b94040923597e2530ffcb2e887bd7c75d76" },
63
"harpoon": { "branch": "harpoon2", "commit": "ed1f853847ffd04b2b61c314865665e1dadf22c7" },
74
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
8-
"lualine.nvim": { "branch": "master", "commit": "a94fc68960665e54408fe37dcf573193c4ce82c9" },
9-
"mason-lspconfig.nvim": { "branch": "main", "commit": "bb3a17efc797c34c054463174e5522442576ebd8" },
10-
"mason.nvim": { "branch": "main", "commit": "8024d64e1330b86044fed4c8494ef3dcd483a67c" },
5+
"lualine.nvim": { "branch": "master", "commit": "b8c23159c0161f4b89196f74ee3a6d02cdc3a955" },
6+
"mason-lspconfig.nvim": { "branch": "main", "commit": "5e085efe67fccb13372d54331d849219662a7e93" },
7+
"mason.nvim": { "branch": "main", "commit": "7dc4facca9702f95353d5a1f87daf23d78e31c2a" },
118
"mini.nvim": { "branch": "main", "commit": "94cae4660a8b2d95dbbd56e1fbc6fcfa2716d152" },
12-
"nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" },
13-
"nvim-dap": { "branch": "master", "commit": "5dd4d50f2e6a2eaf9e57fad023d294ef371bda35" },
9+
"nvim-dap": { "branch": "master", "commit": "7891b01beedc37cef4eaf2e92563bd0a5b6e9c58" },
1410
"nvim-dap-go": { "branch": "main", "commit": "b4421153ead5d726603b02743ea40cf26a51ed5f" },
15-
"nvim-lspconfig": { "branch": "master", "commit": "f47cd681d7cb6048876a2e908b6d8ba1e530d152" },
11+
"nvim-lspconfig": { "branch": "master", "commit": "408cf07b97535825cca6f1afa908d98348712ba6" },
1612
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
17-
"nvim-web-devicons": { "branch": "master", "commit": "0422a19d9aa3aad2c7e5cca167e5407b13407a9d" },
18-
"oil.nvim": { "branch": "master", "commit": "bbad9a76b2617ce1221d49619e4e4b659b3c61fc" },
13+
"nvim-web-devicons": { "branch": "master", "commit": "f66cdfef5e84112045b9ebc3119fee9bddb3c687" },
14+
"oil.nvim": { "branch": "master", "commit": "07f80ad645895af849a597d1cac897059d89b686" },
15+
"opencode.nvim": { "branch": "main", "commit": "2fce982fc8080849afbe3db2ee4229ae9104af30" },
1916
"playground": { "branch": "master", "commit": "ba48c6a62a280eefb7c85725b0915e021a1a0749" },
20-
"plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" },
21-
"render-markdown.nvim": { "branch": "main", "commit": "7620d4e96eb5cf8d12e76c6fcaf1267628564ba9" },
17+
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
18+
"render-markdown.nvim": { "branch": "main", "commit": "e76eb2e4262f0f0a1a7bd7a454dd7d44f1299afd" },
2219
"snacks.nvim": { "branch": "main", "commit": "bc0630e43be5699bb94dadc302c0d21615421d93" },
2320
"stay-centered.nvim": { "branch": "main", "commit": "e1a63ccaf2584e97c0ef8e64f9654c9a80d983f6" },
2421
"telescope.nvim": { "branch": "master", "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" },
25-
"undotree": { "branch": "master", "commit": "28f2f54a34baff90ea6f4a735ef1813ad875c743" },
22+
"undotree": { "branch": "master", "commit": "fe9a9d0645f0f5532360b5e5f5c550d7bb4f1869" },
2623
"vim-gofmt": { "branch": "master", "commit": "0e7bef3864287774b8942bcebbb8a3c9a397bc7a" },
2724
"which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" }
2825
}

.config/nvim/lua/lsps/init.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,3 +81,4 @@ vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = "Open diagn
8181
require('lsps.luals')
8282
require('lsps.gopls')
8383
require('lsps.python')
84+
require('lsps.ts')

.config/nvim/lua/lsps/ts.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
vim.lsp.enable('ts_ls')

.config/nvim/lua/plugins/init.lua

Lines changed: 168 additions & 143 deletions
Original file line numberDiff line numberDiff line change
@@ -212,151 +212,176 @@ local plugs = {
212212
-- AI Related Plugins
213213
-- =========================================================================
214214
-- Enable if using copilot w/ codecompanion
215-
-- {'github/copilot.vim'},
216-
{
217-
-- Docs: https://github.com/greggh/claude-code.nvim
218-
'greggh/claude-code.nvim',
219-
dependencies = {
220-
'nvim-lua/plenary.nvim',
221-
},
222-
config = function()
223-
require('claude-code').setup()
224-
end,
225-
},
226215
{
227-
-- Docs: https://github.com/olimorris/codecompanion.nvim
228-
-- TODO: Install and setup
229-
-- https://github.com/Davidyz/VectorCode/blob/main/docs/cli.md
230-
'olimorris/codecompanion.nvim',
231-
dependencies = {
232-
'j-hui/fidget.nvim',
233-
'nvim-lua/plenary.nvim',
234-
'nvim-treesitter/nvim-treesitter',
235-
'nvim-telescope/telescope.nvim',
236-
{
237-
'hrsh7th/nvim-cmp'
238-
},
239-
-- {
240-
-- 'saghen/blink.cmp',
241-
-- lazy = false,
242-
-- version = "*",
243-
-- opts = {
244-
-- cmdline = { sources = {'cmdline' } },
245-
-- sources = {
246-
-- default = { 'lsp', 'path', 'buffer', 'codecompanion' },
247-
-- },
248-
-- },
249-
-- },
250-
},
251-
opts = {
252-
-- system_prompt = function(opts)
253-
-- return ""
254-
-- end,
255-
strategies = {
256-
chat = {
257-
adapter = "anthropic",
258-
},
259-
inline = {
260-
adapter = "anthropic",
261-
},
262-
cmd = {
263-
adapter = "anthropic",
264-
}
265-
},
266-
adapters = {
267-
anthropic = function()
268-
return require("codecompanion.adapters").extend("anthropic", {
269-
env = {
270-
api_key = "cmd:op read op://Private/AnthropicAPI/credential --no-newline"
271-
},
272-
schema = {
273-
model = {
274-
default = "claude-opus-4-20250514",
275-
},
276-
},
277-
})
278-
end
279-
-- return require("codecompanion.adapters").extend("openai_compatible", {
280-
-- env = {
281-
-- url = "http://192.168.1.164:1234", -- optional: default value is ollama url http://127.0.0.1:11434
282-
-- -- api_key = "OpenAI_API_KEY", -- optional: if your endpoint is authenticated
283-
-- chat_url = "/v1/chat/completions", -- optional: default value, override if different
284-
-- models_endpoint = "/v1/models", -- optional: attaches to the end of the URL to form the endpoint to retrieve models
285-
-- },
286-
-- schema = {
287-
-- model = {
288-
-- default = "zeta", -- define llm model to be used
289-
-- },
290-
-- temperature = {
291-
-- order = 2,
292-
-- mapping = "parameters",
293-
-- type = "number",
294-
-- optional = true,
295-
-- default = 0.4,
296-
-- desc = "What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. We generally recommend altering this or top_p but not both.",
297-
-- validate = function(n)
298-
-- return n >= 0 and n <= 2, "Must be between 0 and 2"
299-
-- end,
300-
-- },
301-
-- max_completion_tokens = {
302-
-- order = 3,
303-
-- mapping = "parameters",
304-
-- type = "integer",
305-
-- optional = true,
306-
-- default = nil,
307-
-- desc = "An upper bound for the number of tokens that can be generated for a completion.",
308-
-- validate = function(n)
309-
-- return n > 0, "Must be greater than 0"
310-
-- end,
311-
-- },
312-
-- stop = {
313-
-- order = 4,
314-
-- mapping = "parameters",
315-
-- type = "string",
316-
-- optional = true,
317-
-- default = nil,
318-
-- desc = "Sets the stop sequences to use. When this pattern is encountered the LLM will stop generating text and return. Multiple stop patterns may be set by specifying multiple separate stop parameters in a modelfile.",
319-
-- validate = function(s)
320-
-- return s:len() > 0, "Cannot be an empty string"
321-
-- end,
322-
-- },
323-
-- logit_bias = {
324-
-- order = 5,
325-
-- mapping = "parameters",
326-
-- type = "map",
327-
-- optional = true,
328-
-- default = nil,
329-
-- desc = "Modify the likelihood of specified tokens appearing in the completion. Maps tokens (specified by their token ID) to an associated bias value from -100 to 100. Use https://platform.openai.com/tokenizer to find token IDs.",
330-
-- subtype_key = {
331-
-- type = "integer",
332-
-- },
333-
-- subtype = {
334-
-- type = "integer",
335-
-- validate = function(n)
336-
-- return n >= -100 and n <= 100, "Must be between -100 and 100"
337-
-- end,
338-
-- },
339-
-- },
340-
-- },
341-
-- })
342-
-- end,
343-
-- return require("codecompanion.adapters").extend("gemini", {
344-
-- env = {
345-
-- api_key = "cmd:op read op://Private/GeminiAPIKey/credential --no-newline"
346-
-- },
347-
-- })
348-
-- end
349-
-- return require("codecompanion.adapters").extend("copilot", {
350-
-- schema = {
351-
-- model = {
352-
-- default = "claude-3.7-sonnet",
353-
-- },
354-
-- },
355-
-- })
356-
-- end
357-
},
358-
},
216+
'NickvanDyke/opencode.nvim',
217+
dependencies = {
218+
-- Recommended for better prompt input, and required to use opencode.nvim's embedded terminal — otherwise optional
219+
{ 'folke/snacks.nvim', opts = { input = { enabled = true } } },
220+
},
221+
---@type opencode.Opts
222+
opts = {
223+
-- Your configuration, if any — see lua/opencode/config.lua
224+
},
225+
keys = {
226+
-- Recommended keymaps
227+
{ '<leader>oA', function() require('opencode').ask() end, desc = 'Ask opencode', },
228+
{ '<leader>oa', function() require('opencode').ask('@cursor: ') end, desc = 'Ask opencode about this', mode = 'n', },
229+
{ '<leader>oa', function() require('opencode').ask('@selection: ') end, desc = 'Ask opencode about selection', mode = 'v', },
230+
{ '<leader>ot', function() require('opencode').toggle() end, desc = 'Toggle embedded opencode', },
231+
{ '<leader>on', function() require('opencode').command('session_new') end, desc = 'New session', },
232+
{ '<leader>oy', function() require('opencode').command('messages_copy') end, desc = 'Copy last message', },
233+
{ '<S-C-u>', function() require('opencode').command('messages_half_page_up') end, desc = 'Scroll messages up', },
234+
{ '<S-C-d>', function() require('opencode').command('messages_half_page_down') end, desc = 'Scroll messages down', },
235+
{ '<leader>op', function() require('opencode').select_prompt() end, desc = 'Select prompt', mode = { 'n', 'v', }, },
236+
-- Example: keymap for custom prompt
237+
{ '<leader>oe', function() require('opencode').prompt("Explain @cursor and its context") end, desc = "Explain code near cursor", },
238+
},
359239
}
240+
-- {'github/copilot.vim'},
241+
-- {
242+
-- -- Docs: https://github.com/greggh/claude-code.nvim
243+
-- 'greggh/claude-code.nvim',
244+
-- dependencies = {
245+
-- 'nvim-lua/plenary.nvim',
246+
-- },
247+
-- config = function()
248+
-- require('claude-code').setup()
249+
-- end,
250+
-- },
251+
-- {
252+
-- -- Docs: https://github.com/olimorris/codecompanion.nvim
253+
-- -- TODO: Install and setup
254+
-- -- https://github.com/Davidyz/VectorCode/blob/main/docs/cli.md
255+
-- 'olimorris/codecompanion.nvim',
256+
-- dependencies = {
257+
-- 'j-hui/fidget.nvim',
258+
-- 'nvim-lua/plenary.nvim',
259+
-- 'nvim-treesitter/nvim-treesitter',
260+
-- 'nvim-telescope/telescope.nvim',
261+
-- {
262+
-- 'hrsh7th/nvim-cmp'
263+
-- },
264+
-- -- {
265+
-- -- 'saghen/blink.cmp',
266+
-- -- lazy = false,
267+
-- -- version = "*",
268+
-- -- opts = {
269+
-- -- cmdline = { sources = {'cmdline' } },
270+
-- -- sources = {
271+
-- -- default = { 'lsp', 'path', 'buffer', 'codecompanion' },
272+
-- -- },
273+
-- -- },
274+
-- -- },
275+
-- },
276+
-- opts = {
277+
-- -- system_prompt = function(opts)
278+
-- -- return ""
279+
-- -- end,
280+
-- strategies = {
281+
-- chat = {
282+
-- adapter = "anthropic",
283+
-- },
284+
-- inline = {
285+
-- adapter = "anthropic",
286+
-- },
287+
-- cmd = {
288+
-- adapter = "anthropic",
289+
-- }
290+
-- },
291+
-- adapters = {
292+
-- anthropic = function()
293+
-- return require("codecompanion.adapters").extend("anthropic", {
294+
-- env = {
295+
-- api_key = "cmd:op read op://Private/AnthropicAPI/credential --no-newline"
296+
-- },
297+
-- schema = {
298+
-- model = {
299+
-- default = "claude-opus-4-20250514",
300+
-- },
301+
-- },
302+
-- })
303+
-- end
304+
-- -- return require("codecompanion.adapters").extend("openai_compatible", {
305+
-- -- env = {
306+
-- -- url = "http://192.168.1.164:1234", -- optional: default value is ollama url http://127.0.0.1:11434
307+
-- -- -- api_key = "OpenAI_API_KEY", -- optional: if your endpoint is authenticated
308+
-- -- chat_url = "/v1/chat/completions", -- optional: default value, override if different
309+
-- -- models_endpoint = "/v1/models", -- optional: attaches to the end of the URL to form the endpoint to retrieve models
310+
-- -- },
311+
-- -- schema = {
312+
-- -- model = {
313+
-- -- default = "zeta", -- define llm model to be used
314+
-- -- },
315+
-- -- temperature = {
316+
-- -- order = 2,
317+
-- -- mapping = "parameters",
318+
-- -- type = "number",
319+
-- -- optional = true,
320+
-- -- default = 0.4,
321+
-- -- desc = "What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. We generally recommend altering this or top_p but not both.",
322+
-- -- validate = function(n)
323+
-- -- return n >= 0 and n <= 2, "Must be between 0 and 2"
324+
-- -- end,
325+
-- -- },
326+
-- -- max_completion_tokens = {
327+
-- -- order = 3,
328+
-- -- mapping = "parameters",
329+
-- -- type = "integer",
330+
-- -- optional = true,
331+
-- -- default = nil,
332+
-- -- desc = "An upper bound for the number of tokens that can be generated for a completion.",
333+
-- -- validate = function(n)
334+
-- -- return n > 0, "Must be greater than 0"
335+
-- -- end,
336+
-- -- },
337+
-- -- stop = {
338+
-- -- order = 4,
339+
-- -- mapping = "parameters",
340+
-- -- type = "string",
341+
-- -- optional = true,
342+
-- -- default = nil,
343+
-- -- desc = "Sets the stop sequences to use. When this pattern is encountered the LLM will stop generating text and return. Multiple stop patterns may be set by specifying multiple separate stop parameters in a modelfile.",
344+
-- -- validate = function(s)
345+
-- -- return s:len() > 0, "Cannot be an empty string"
346+
-- -- end,
347+
-- -- },
348+
-- -- logit_bias = {
349+
-- -- order = 5,
350+
-- -- mapping = "parameters",
351+
-- -- type = "map",
352+
-- -- optional = true,
353+
-- -- default = nil,
354+
-- -- desc = "Modify the likelihood of specified tokens appearing in the completion. Maps tokens (specified by their token ID) to an associated bias value from -100 to 100. Use https://platform.openai.com/tokenizer to find token IDs.",
355+
-- -- subtype_key = {
356+
-- -- type = "integer",
357+
-- -- },
358+
-- -- subtype = {
359+
-- -- type = "integer",
360+
-- -- validate = function(n)
361+
-- -- return n >= -100 and n <= 100, "Must be between -100 and 100"
362+
-- -- end,
363+
-- -- },
364+
-- -- },
365+
-- -- },
366+
-- -- })
367+
-- -- end,
368+
-- -- return require("codecompanion.adapters").extend("gemini", {
369+
-- -- env = {
370+
-- -- api_key = "cmd:op read op://Private/GeminiAPIKey/credential --no-newline"
371+
-- -- },
372+
-- -- })
373+
-- -- end
374+
-- -- return require("codecompanion.adapters").extend("copilot", {
375+
-- -- schema = {
376+
-- -- model = {
377+
-- -- default = "claude-3.7-sonnet",
378+
-- -- },
379+
-- -- },
380+
-- -- })
381+
-- -- end
382+
-- },
383+
-- },
384+
-- }
360385
}
361386

362387
-- can add opts to .setup(plugs)

0 commit comments

Comments
 (0)