forked from coder/claudecode.nvim
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathopencode.lua
More file actions
27 lines (23 loc) · 906 Bytes
/
opencode.lua
File metadata and controls
27 lines (23 loc) · 906 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
if vim.fn.has("nvim-0.8.0") ~= 1 then
vim.api.nvim_err_writeln("OpenCode requires Neovim >= 0.8.0")
return
end
if vim.g.loaded_opencode then
return
end
vim.g.loaded_opencode = 1
--- Example: In your `init.lua`, you can set `vim.g.opencode_auto_setup = { auto_start = true }`
--- to automatically start OpenCode when Neovim loads.
if vim.g.opencode_auto_setup then
vim.defer_fn(function()
require("opencode").setup(vim.g.opencode_auto_setup)
end, 0)
end
-- Commands are now registered in lua/opencode/init.lua's _create_commands function
-- when require("opencode").setup() is called.
-- This file (plugin/opencode.lua) is primarily for the load guard
-- and the optional auto-setup mechanism.
local main_module_ok, _ = pcall(require, "opencode")
if not main_module_ok then
vim.notify("OpenCode: Failed to load main module. Plugin may not function correctly.", vim.log.levels.ERROR)
end