|
4 | 4 | ---@module 'lazy' |
5 | 5 | ---@module 'mason-lspconfig' |
6 | 6 | ---@module 'mcphub' |
7 | | ----@module 'vectorcode' |
8 | 7 | ---@module 'snacks' |
9 | 8 | -- TODO: Explore LuaLine integration |
10 | 9 |
|
11 | | -local lualine_vectorcode = { |
12 | | - function() return require("vectorcode.integrations").lualine({ show_job_count = true }) end, |
13 | | -} |
14 | | - |
15 | 10 | ---@type LazySpec |
16 | 11 | return { |
17 | 12 | { |
@@ -49,176 +44,152 @@ return { |
49 | 44 | "ravitemer/codecompanion-history.nvim", |
50 | 45 | }, |
51 | 46 | cmd = { "CodeCompanion" }, |
52 | | - --- Use a function to ensure VectorCode is loaded before CodeCompanion |
53 | | - opts = function() |
54 | | - return { |
55 | | - log_level = "DEBUG", |
56 | | - |
57 | | - adapters = { |
58 | | - copilot = function() |
59 | | - return require("codecompanion.adapters").extend("copilot", { |
60 | | - schema = { |
61 | | - model = { |
62 | | - default = "gpt-5-mini", |
63 | | - }, |
| 47 | + opts = { |
| 48 | + log_level = "DEBUG", |
| 49 | + |
| 50 | + adapters = { |
| 51 | + copilot = function() |
| 52 | + return require("codecompanion.adapters").extend("copilot", { |
| 53 | + schema = { |
| 54 | + model = { |
| 55 | + default = "gpt-5-mini", |
64 | 56 | }, |
65 | | - }) |
66 | | - end, |
67 | | - }, |
68 | | - |
69 | | - display = { |
70 | | - action_palette = { |
71 | | - provider = "snacks", |
72 | | - opts = { |
73 | | - show_default_actions = true, |
74 | | - show_default_prompt_library = true, |
75 | 57 | }, |
76 | | - }, |
| 58 | + }) |
| 59 | + end, |
| 60 | + }, |
77 | 61 |
|
78 | | - chat = { |
79 | | - intro_message = "", |
| 62 | + display = { |
| 63 | + action_palette = { |
| 64 | + provider = "snacks", |
| 65 | + opts = { |
| 66 | + show_default_actions = true, |
| 67 | + show_default_prompt_library = true, |
80 | 68 | }, |
81 | 69 | }, |
82 | 70 |
|
83 | | - extensions = { |
84 | | - history = { |
85 | | - enabled = true, |
86 | | - opts = { |
87 | | - -- Keymap to open history from chat buffer (default: gh) |
88 | | - keymap = "gh", |
89 | | - -- Keymap to save the current chat manually (when auto_save is disabled) |
90 | | - save_chat_keymap = "sc", |
91 | | - -- Save all chats by default (disable to save only manually using 'sc') |
92 | | - auto_save = true, |
93 | | - -- Number of days after which chats are automatically deleted (0 to disable) |
94 | | - expiration_days = 0, |
95 | | - -- Picker interface ("telescope" or "snacks" or "fzf-lua" or "default") |
96 | | - picker = "snacks", |
97 | | - ---On exiting and entering neovim, loads the last chat on opening chat |
98 | | - continue_last_chat = false, |
99 | | - ---When chat is cleared with `gx` delete the chat from history |
100 | | - delete_on_clearing_chat = false, |
101 | | - ---Directory path to save the chats |
102 | | - dir_to_save = vim.fn.stdpath("data") .. "/codecompanion-history", |
103 | | - ---Enable detailed logging for history extension |
104 | | - enable_logging = false, |
105 | | - ---Automatically generate titles for new chats |
106 | | - auto_generate_title = true, |
107 | | - title_generation_opts = { |
108 | | - ---Adapter for generating titles (defaults to current chat adapter) |
109 | | - adapter = "copilot", |
110 | | - ---Model for generating titles (defaults to current chat model) |
111 | | - model = "gpt-5-mini", |
112 | | - }, |
113 | | - }, |
114 | | - }, |
| 71 | + chat = { |
| 72 | + intro_message = "", |
| 73 | + }, |
| 74 | + }, |
115 | 75 |
|
116 | | - mcphub = { |
117 | | - callback = "mcphub.extensions.codecompanion", |
118 | | - opts = { |
119 | | - make_vars = true, |
120 | | - make_slash_commands = true, |
121 | | - show_result_in_chat = true, |
| 76 | + extensions = { |
| 77 | + history = { |
| 78 | + enabled = true, |
| 79 | + opts = { |
| 80 | + -- Keymap to open history from chat buffer (default: gh) |
| 81 | + keymap = "gh", |
| 82 | + -- Keymap to save the current chat manually (when auto_save is disabled) |
| 83 | + save_chat_keymap = "sc", |
| 84 | + -- Save all chats by default (disable to save only manually using 'sc') |
| 85 | + auto_save = true, |
| 86 | + -- Number of days after which chats are automatically deleted (0 to disable) |
| 87 | + expiration_days = 0, |
| 88 | + -- Picker interface ("telescope" or "snacks" or "fzf-lua" or "default") |
| 89 | + picker = "snacks", |
| 90 | + ---On exiting and entering neovim, loads the last chat on opening chat |
| 91 | + continue_last_chat = false, |
| 92 | + ---When chat is cleared with `gx` delete the chat from history |
| 93 | + delete_on_clearing_chat = false, |
| 94 | + ---Directory path to save the chats |
| 95 | + dir_to_save = vim.fn.stdpath("data") .. "/codecompanion-history", |
| 96 | + ---Enable detailed logging for history extension |
| 97 | + enable_logging = false, |
| 98 | + ---Automatically generate titles for new chats |
| 99 | + auto_generate_title = true, |
| 100 | + title_generation_opts = { |
| 101 | + ---Adapter for generating titles (defaults to current chat adapter) |
| 102 | + adapter = "copilot", |
| 103 | + ---Model for generating titles (defaults to current chat model) |
| 104 | + model = "gpt-5-mini", |
122 | 105 | }, |
123 | 106 | }, |
| 107 | + }, |
124 | 108 |
|
125 | | - vectorcode = { |
126 | | - ---@type VectorCode.CodeCompanion.ExtensionOpts |
127 | | - opts = { |
128 | | - -- add_tool = true, |
129 | | - -- add_slash_command = true, |
130 | | - tool_group = { |
131 | | - extras = { "file_search" }, |
132 | | - }, |
133 | | - tool_opts = { |
134 | | - ---@type VectorCode.CodeCompanion.ToolOpts |
135 | | - ["*"] = { |
136 | | - use_lsp = true, |
137 | | - }, |
138 | | - ---@type VectorCode.CodeCompanion.QueryToolOpts |
139 | | - query = { |
140 | | - chunk_mode = true, |
141 | | - }, |
142 | | - }, |
143 | | - }, |
| 109 | + mcphub = { |
| 110 | + callback = "mcphub.extensions.codecompanion", |
| 111 | + opts = { |
| 112 | + make_vars = true, |
| 113 | + make_slash_commands = true, |
| 114 | + show_result_in_chat = true, |
144 | 115 | }, |
145 | 116 | }, |
| 117 | + }, |
146 | 118 |
|
147 | | - interactions = { |
148 | | - chat = { |
149 | | - adapter = "copilot", |
| 119 | + interactions = { |
| 120 | + chat = { |
| 121 | + adapter = "copilot", |
150 | 122 |
|
151 | | - keymaps = { |
152 | | - close = { |
153 | | - modes = { |
154 | | - n = "q", |
155 | | - i = "<C-q>", |
156 | | - }, |
157 | | - index = 4, |
158 | | - callback = "keymaps.close", |
159 | | - description = "Close Chat", |
| 123 | + keymaps = { |
| 124 | + close = { |
| 125 | + modes = { |
| 126 | + n = "q", |
| 127 | + i = "<C-q>", |
160 | 128 | }, |
161 | | - stop = { |
162 | | - modes = { |
163 | | - n = "<C-c>", |
164 | | - i = "<C-c>", |
165 | | - }, |
166 | | - index = 5, |
167 | | - callback = "keymaps.stop", |
168 | | - description = "Stop Request", |
169 | | - }, |
170 | | - }, |
171 | | - |
172 | | - roles = { |
173 | | - ---@type string|fun(adapter: CodeCompanion.HTTPAdapter|CodeCompanion.ACPAdapter): string |
174 | | - llm = function(adapter) return adapter.formatted_name end, |
| 129 | + index = 4, |
| 130 | + callback = "keymaps.close", |
| 131 | + description = "Close Chat", |
175 | 132 | }, |
176 | | - |
177 | | - tools = { |
178 | | - opts = { |
179 | | - default_tools = { "mcp", "vectorcode_toolbox" }, |
| 133 | + stop = { |
| 134 | + modes = { |
| 135 | + n = "<C-c>", |
| 136 | + i = "<C-c>", |
180 | 137 | }, |
| 138 | + index = 5, |
| 139 | + callback = "keymaps.stop", |
| 140 | + description = "Stop Request", |
181 | 141 | }, |
182 | 142 | }, |
183 | 143 |
|
184 | | - inline = { |
185 | | - adapter = "copilot", |
| 144 | + roles = { |
| 145 | + ---@type string|fun(adapter: CodeCompanion.HTTPAdapter|CodeCompanion.ACPAdapter): string |
| 146 | + llm = function(adapter) return adapter.formatted_name end, |
186 | 147 | }, |
187 | 148 |
|
188 | | - cmd = { |
189 | | - adapter = "copilot", |
| 149 | + tools = { |
| 150 | + opts = { |
| 151 | + default_tools = { "mcp" }, |
| 152 | + }, |
190 | 153 | }, |
191 | 154 | }, |
192 | 155 |
|
193 | | - prompt_library = { |
194 | | - markdown = { |
195 | | - dirs = { |
196 | | - vim.fn.getcwd() .. "/.ai/prompts", |
197 | | - vim.env.XDG_CONFIG_HOME .. "/ai/prompts/codecompanion", |
198 | | - }, |
| 156 | + inline = { |
| 157 | + adapter = "copilot", |
| 158 | + }, |
| 159 | + |
| 160 | + cmd = { |
| 161 | + adapter = "copilot", |
| 162 | + }, |
| 163 | + }, |
| 164 | + |
| 165 | + prompt_library = { |
| 166 | + markdown = { |
| 167 | + dirs = { |
| 168 | + vim.fn.getcwd() .. "/.ai/prompts", |
| 169 | + vim.env.XDG_CONFIG_HOME .. "/ai/prompts/codecompanion", |
199 | 170 | }, |
200 | 171 | }, |
| 172 | + }, |
201 | 173 |
|
202 | | - rules = { |
203 | | - opts = { |
204 | | - chat = { |
205 | | - autoload = function() |
206 | | - local is_work = require("util").cwd_is_descendant_of_dir(vim.env.HOME .. "/dev/work") |
207 | | - if is_work then return { "default", "work" } end |
208 | | - return "default" |
209 | | - end, |
210 | | - }, |
| 174 | + rules = { |
| 175 | + opts = { |
| 176 | + chat = { |
| 177 | + autoload = function() |
| 178 | + local is_work = require("util").cwd_is_descendant_of_dir(vim.env.HOME .. "/dev/work") |
| 179 | + if is_work then return { "default", "work" } end |
| 180 | + return "default" |
| 181 | + end, |
211 | 182 | }, |
| 183 | + }, |
212 | 184 |
|
213 | | - work = { |
214 | | - description = "Global memory files for work related projects", |
215 | | - files = { |
216 | | - "~/dev/work/AGENTS.md", |
217 | | - }, |
| 185 | + work = { |
| 186 | + description = "Global memory files for work related projects", |
| 187 | + files = { |
| 188 | + "~/dev/work/AGENTS.md", |
218 | 189 | }, |
219 | 190 | }, |
220 | | - } |
221 | | - end, |
| 191 | + }, |
| 192 | + }, |
222 | 193 | keys = { |
223 | 194 | { "<leader>a", "", desc = "+ai", mode = { "n", "v" } }, |
224 | 195 | { |
@@ -277,47 +248,4 @@ return { |
277 | 248 | }, |
278 | 249 | }, |
279 | 250 | }, |
280 | | - |
281 | | - { |
282 | | - "Davidyz/VectorCode", |
283 | | - build = "uv tool upgrade vectorcode", -- Optional but recommended. This keeps your CLI up-to-date. |
284 | | - dependencies = { |
285 | | - "nvim-lua/plenary.nvim", |
286 | | - { |
287 | | - "neovim/nvim-lspconfig", |
288 | | - ---@class PluginLspOpts |
289 | | - opts = { |
290 | | - servers = { vectorcode_server = { mason = false } }, |
291 | | - }, |
292 | | - }, |
293 | | - }, |
294 | | - cmd = { "VectorCode" }, |
295 | | - ---@type VectorCode.Opts|{} |
296 | | - opts = { |
297 | | - async_backend = "lsp", |
298 | | - on_setup = { |
299 | | - update = true, -- Whether to update the CLI on setup |
300 | | - lsp = true, -- Whether to setup the LSP server |
301 | | - }, |
302 | | - }, |
303 | | - keys = { |
304 | | - { |
305 | | - "<leader>au", |
306 | | - function() return require("vectorcode").update() end, |
307 | | - desc = "Update (VectorCode)", |
308 | | - mode = { "n", "v" }, |
309 | | - }, |
310 | | - }, |
311 | | - }, |
312 | | - |
313 | | - -- Statusline, Winbar and Bufferline (buffer tabs) configuration |
314 | | - { |
315 | | - "nvim-lualine/lualine.nvim", |
316 | | - optional = true, |
317 | | - |
318 | | - opts = function(_, opts) |
319 | | - opts.sections = opts.sections or {} |
320 | | - opts.sections.lualine_c = table.insert(opts.sections.lualine_c or {}, lualine_vectorcode) |
321 | | - end, |
322 | | - }, |
323 | 251 | } |
0 commit comments