@@ -6,6 +6,8 @@ local list = require("nvim-devdocs.list")
66local notify = require (" nvim-devdocs.notify" )
77local pickers = require (" nvim-devdocs.pickers" )
88local operations = require (" nvim-devdocs.operations" )
9+ local config = require (" nvim-devdocs.config" )
10+ local completion = require (" nvim-devdocs.completion" )
911local plugin_config = require (" nvim-devdocs.config" ).get ()
1012
1113local registery_path = path :new (plugin_config .dir_path , " registery.json" )
@@ -84,4 +86,22 @@ M.update_all = function()
8486 end
8587end
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+
87107return M
0 commit comments