ms-jpq / coq_nvim

Fast as FUCK nvim completion. SQLite, concurrent scheduler, hundreds of hours of optimization.
GNU General Public License v3.0
3.54k stars 100 forks source link

How to run COQnow on startup? #22

Closed IndianBoy42 closed 3 years ago

IndianBoy42 commented 3 years ago

I don't really want to have to run COQnow everytime

I tried to run it in init.lua but its giving me an error that it is not an editor command

npielawski commented 3 years ago

lua coq.COQnow() seems to do the trick once the extension is loaded

vxio commented 3 years ago

This worked for me:

I created a new file ~/.config/nvim/after/plugin/coq.lua and set

vim.cmd('COQnow')

local lsp = require 'lspconfig'
lsp.gopls.setup(coq.lsp_ensure_capabilities({
  cmd = {"gopls", "serve"},
    settings = {
      gopls = {
        analyses = {
          unusedparams = true,
        },
        staticcheck = true,
      },
    },
}))
gohm44 commented 3 years ago

I did try both of them but unfortunately still getting an error:

E5108: Error executing lua [string ":lua"]:1: attempt to index global 'coq' (a nil value)

I guess maybe is sill too early to execute command. I'm using packer as plugin manager. Does any of you use it?

creativenull commented 3 years ago

If you're using packer to lazy load coq_nvim then it won't work. You want to load it on demand, else coq variable won't be available, hence the error.

use {'ms-jpq/coq_nvim'}
gohm44 commented 3 years ago

No, I'm not using packer to lazy load coq_nvim.

use {'ms-jpq/coq_nvim'}
use {'ms-jpq/coq.artifacts'} 

I have noticed some issues in other threads related to packer, so my suspicions is packer-coq relation. That's the reason of my question about it.

Shougo commented 3 years ago

You can use autocmd VimEnter * COQnow.

ms-jpq commented 3 years ago

@gohm44

If you are using packer, the load order is a bit funny.

Please update my repo and use the following config:

vim.schedule(function ()
  local lsp = require "lspconfig"
  require("packer").loader("coq_nvim coq.artifacts")
  lsp.<server>.setup(require("coq")().lsp_ensure_capabilities(<stuff...>))
end)
ms-jpq commented 3 years ago

Added a --shut-up flag.

:COQnow --shut-up will make coq.nvim not print the apple style greeting message in like 12 different languages.