coq_nvim
coq_nvim copied to clipboard
Feature Request: Make use of a 'require("coq_nvim").setup()' style lua function.
Specifically a function would be useful since then we could inspect its return value.
For context:
I am frequently moving my neovim config between machines so I frequently re-downloading my plugins. Plugins that have a specific update process are not uncommon, :MasonUpdate comes to mind. But most plugins place their update step after the initial loading of the plugin, for example you run :MasonUpdate after running require('mason').setup() and as such most of the package managers I have use use a similar structure. Where as coq_nvim requires (assuming a new install) :COQdeps being executed before :COQnow ( which seems equivalent to setup() for all intents and purposes ). This makes automating the initial setup process for coq_nvim functionally impossible with some of the current popular package managers.
Things I have attempted to resolve this on my end:
-
Run vim.cmd.COQdeps() in a pcall. This seems to be a naive approach on my part since it would appear vim function calls never return an error unless they don't exist outright. Or at the very least COQdeps() doesn't.
-
Run COQdeps on every single startup. This on face value seems like the solution however COQdeps is very noisy and opens panes. This makes running it on every startup impractical to say the least. If there was some way to run it silently that would make this more practical but I don't know if 'just run COQdeps every time' is a acceptable solution.
Although without looking over the code (and learning a bit more lua) I don't know if there is a implementation reason for the setup process, and for clarity I think COQdeps and COQnow are fine commands for manual setup. Specifically I see two solutions for making automatic installation a little more practical :
-
Create a
setup()function that is functionally equivalent to:COQnowbut is silent by default and returns a true or false value, true ifcoq_nvimwas loaded correctly and false if:COQdepsneeds to be executed. From here it is fairly trivial to execute:COQdepswhen needed. Ideally including a second lua function, something like coq_deps() (unsure what the lua function naming scheme is typically) which silently installs the deps without the opening any panes (this function could also return an error or similar if something goes wrong in this step). -
Similar to above, make a
setup()function that is functionally equivalent to:COQnowbut silent by default. This time however we fold the logic of:COQdepsinside it. Now ifcoq_nvimdetects that it needs its dependencies setup it just does that internally as part of it's initial setup before continuing along as normal.
Have you tried using the build (or equivalent) field provided by some plugin managers? It runs some command (on a terminal or an intermal vim command) after a plugin is installed/downloaded. You could use :COQdeps as a build command.
I think my code config could help u U just have to install a lsp and you're done it work for me soo why not you try it out
https://gitlab.com/Watynecc/config-files
-- lsp
vim.g.coq_settings = {
auto_start = 'shut-up',
clients = {
tmux = { enabled = false },
buffers = {
enabled = false,
}
},
}
require("mason").setup()
require("mason-lspconfig").setup_handlers({
function (server_name) -- default handler (optional)
require("lspconfig")[server_name].setup(require('coq').lsp_ensure_capabilities({}))
end
})