LSP and coq now play nicely

This commit is contained in:
juan 2021-09-08 19:57:41 +08:00
parent ea148c695e
commit 781e666443
5 changed files with 25 additions and 26 deletions

View File

@ -16,3 +16,6 @@ opt.ignorecase = true
opt.smartcase = true opt.smartcase = true
opt.smartindent = true opt.smartindent = true
opt.mouse = "i" opt.mouse = "i"
-- completion for lua
opt.completeopt = 'menuone,noselect'

View File

@ -43,8 +43,8 @@ return require('packer').startup(function(use)
use {'neovim/nvim-lspconfig', event = 'BufRead'} use {'neovim/nvim-lspconfig', event = 'BufRead'}
use { use {
'kabouzeid/nvim-lspinstall', 'kabouzeid/nvim-lspinstall',
after = 'nvim-lspconfig', config = function() require "plugins.lspinstall" end,
config = function() require "plugins.lspinstall" end after = 'nvim-lspconfig'
} }
use {'onsails/lspkind-nvim', after = 'nvim-lspconfig'} use {'onsails/lspkind-nvim', after = 'nvim-lspconfig'}
use {"ray-x/lsp_signature.nvim", after = 'nvim-lspconfig'} use {"ray-x/lsp_signature.nvim", after = 'nvim-lspconfig'}
@ -52,8 +52,10 @@ return require('packer').startup(function(use)
use { use {
'ms-jpq/coq_nvim', 'ms-jpq/coq_nvim',
branch = 'coq', branch = 'coq',
requires = {'ms-jpq/coq.artifacts', branch = 'artifacts'} event = 'InsertEnter',
config = function() require "plugins.coq" end
} }
use {'ms-jpq/coq.artifacts', after = 'coq_nvim', branch = 'artifacts'}
-- formating and editing -- formating and editing
use {"sbdchd/neoformat", cmd = "Neoformat"} use {"sbdchd/neoformat", cmd = "Neoformat"}
@ -89,7 +91,7 @@ return require('packer').startup(function(use)
} }
use { use {
"lukas-reineke/indent-blankline.nvim", "lukas-reineke/indent-blankline.nvim",
after = {"nvim-treesitter","nvim-base16"}, after = {"nvim-treesitter", "nvim-base16"},
config = function() require "plugins.indent-blankline" end config = function() require "plugins.indent-blankline" end
} }

3
lua/plugins/coq.lua Normal file
View File

@ -0,0 +1,3 @@
vim.g.coq_settings = {auto_start = true, clients = {tabnine = {enabled = true}}}
local coq = require('coq')
vim.cmd('COQnow')

View File

@ -1,26 +1,15 @@
local function setup_servers() local function setup_servers()
require'lspinstall'.setup(coq.lsp_ensure_capabilities()) require'lspinstall'.setup()
local servers = require'lspinstall'.installed_servers() local servers = require'lspinstall'.installed_servers()
for _, server in pairs(servers) do require'lspconfig'[server].setup {} end for _, server in pairs(servers) do
require'lspconfig'[server].setup{}
end
end end
setup_servers()
-- Automatically reload after `:LspInstall <server>` so we don't have to restart neovim -- Automatically reload after `:LspInstall <server>` so we don't have to restart neovim
require'lspinstall'.post_install_hook = function() require'lspinstall'.post_install_hook = function ()
setup_servers() -- reload installed servers setup_servers() -- reload installed servers
vim.cmd("bufdo e") -- this triggers the FileType autocmd that starts the server vim.cmd("bufdo e") -- this triggers the FileType autocmd that starts the server
end end
-- setup coq.lua
local lsp = require 'lspconfig'
require("packer").loader("coq_nvim coq.artifacts")
vim.g.coq_settings = {auto_start = true, clients = {tabnine = {enabled = true}}}
local coq = require 'coq'
setup_servers()
lsp.gopls.setup(coq.lsp_ensure_capabilities({
cmd = {"gopls", "serve"},
settings = {gopls = {analyses = {unusedparams = true}, staticcheck = true}}
}))
-- load coq.lua
vim.cmd("COQnow -s")

View File

@ -79,6 +79,7 @@ _G.packer_plugins = {
}, },
coq_nvim = { coq_nvim = {
after = { "coq.artifacts" }, after = { "coq.artifacts" },
config = { "\27LJ\1\2+\0\0\2\0\2\0\0044\0\0\0%\1\1\0>\0\2\1G\0\1\0\16plugins.coq\frequire\0" },
loaded = false, loaded = false,
needs_bufread = true, needs_bufread = true,
path = "/home/juan/.local/share/nvim/site/pack/packer/opt/coq_nvim" path = "/home/juan/.local/share/nvim/site/pack/packer/opt/coq_nvim"
@ -229,10 +230,11 @@ vim.cmd [[augroup packer_load_aucmds]]
vim.cmd [[au!]] vim.cmd [[au!]]
-- Event lazy-loads -- Event lazy-loads
time([[Defining lazy-load event autocommands]], true) time([[Defining lazy-load event autocommands]], true)
vim.cmd [[au BufAdd * ++once lua require("packer.load")({'shade.nvim'}, { event = "BufAdd *" }, _G.packer_plugins)]] vim.cmd [[au BufRead * ++once lua require("packer.load")({'nvim-treesitter', 'nvim-lspconfig', 'vim-sandwich'}, { event = "BufRead *" }, _G.packer_plugins)]]
vim.cmd [[au FileType html,css ++once lua require("packer.load")({'emmet-vim'}, { event = "FileType html,css" }, _G.packer_plugins)]] vim.cmd [[au FileType html,css ++once lua require("packer.load")({'emmet-vim'}, { event = "FileType html,css" }, _G.packer_plugins)]]
vim.cmd [[au VimEnter * ++once lua require("packer.load")({'packer.nvim', 'nvim-base16'}, { event = "VimEnter *" }, _G.packer_plugins)]] vim.cmd [[au VimEnter * ++once lua require("packer.load")({'packer.nvim', 'nvim-base16'}, { event = "VimEnter *" }, _G.packer_plugins)]]
vim.cmd [[au BufRead * ++once lua require("packer.load")({'nvim-treesitter', 'nvim-lspconfig', 'vim-sandwich'}, { event = "BufRead *" }, _G.packer_plugins)]] vim.cmd [[au InsertEnter * ++once lua require("packer.load")({'coq_nvim'}, { event = "InsertEnter *" }, _G.packer_plugins)]]
vim.cmd [[au BufAdd * ++once lua require("packer.load")({'shade.nvim'}, { event = "BufAdd *" }, _G.packer_plugins)]]
time([[Defining lazy-load event autocommands]], false) time([[Defining lazy-load event autocommands]], false)
vim.cmd("augroup END") vim.cmd("augroup END")
if should_profile then save_profiles() end if should_profile then save_profiles() end