Skip to content
This repository was archived by the owner on May 16, 2024. It is now read-only.

Commit e1f423c

Browse files
fix: .setup() with Packer
move .setup() declaration inside init.lua
1 parent aa884e3 commit e1f423c

File tree

2 files changed

+20
-25
lines changed

2 files changed

+20
-25
lines changed

lua/nvim-devdocs/init.lua

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ local list = require("nvim-devdocs.list")
66
local notify = require("nvim-devdocs.notify")
77
local pickers = require("nvim-devdocs.pickers")
88
local operations = require("nvim-devdocs.operations")
9+
local config = require("nvim-devdocs.config")
10+
local completion = require("nvim-devdocs.completion")
911
local plugin_config = require("nvim-devdocs.config").get()
1012

1113
local registery_path = path:new(plugin_config.dir_path, "registery.json")
@@ -84,4 +86,22 @@ M.update_all = function()
8486
end
8587
end
8688

89+
M.setup = function(opts)
90+
config.setup(opts)
91+
92+
local ensure_installed = config.get().ensure_installed
93+
94+
vim.defer_fn(function() operations.install_args(ensure_installed) end, 5000)
95+
96+
local cmd = vim.api.nvim_create_user_command
97+
98+
cmd("DevdocsFetch", M.fetch_registery, {})
99+
cmd("DevdocsInstall", M.install_doc, { nargs = "*", complete = completion.get_non_installed })
100+
cmd("DevdocsUninstall", M.uninstall_doc, { nargs = "*", complete = completion.get_installed })
101+
cmd("DevdocsOpen", M.open_doc, { nargs = "?", complete = completion.get_installed })
102+
cmd("DevdocsOpenFloat", M.open_doc_float, { nargs = "?", complete = completion.get_installed })
103+
cmd("DevdocsUpdate", M.update, { nargs = "*", complete = completion.get_updatable })
104+
cmd("DevdocsUpdateAll", M.update_all, {})
105+
end
106+
87107
return M

plugin/nvim-devdocs.lua

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)