added coq + fixed diagnostics

This commit is contained in:
MasterGordon 2021-09-27 22:14:28 +02:00
parent fc6344e1ff
commit 7f9cdd2b11
3 changed files with 114 additions and 30 deletions

View File

@ -64,7 +64,7 @@ return require("packer").startup(
use {
"nvim-treesitter/nvim-treesitter",
run = ":TSUpdate",
after = "nvim-compe",
-- after = "nvim-compe",
config = function()
local npairs = require("nvim-autopairs")
npairs.setup(
@ -74,13 +74,6 @@ return require("packer").startup(
}
)
require("nvim-autopairs.completion.compe").setup(
{
map_cr = true, -- map <CR> on insert mode
map_complete = true, -- it will auto insert `(` after select function or method item
auto_select = false -- auto select first item
}
)
require "nvim-treesitter.configs".setup {
context_commentstring = {
enable = true,
@ -125,12 +118,12 @@ return require("packer").startup(
"jose-elias-alvarez/null-ls.nvim"
}
}
use {
--[[ use {
"hrsh7th/nvim-compe",
config = function()
require "plugins/compe"
end
}
} ]]
use {
"nvim-telescope/telescope.nvim",
config = function()
@ -199,8 +192,7 @@ return require("packer").startup(
}
use "jbyuki/venn.nvim"
use "editorconfig/editorconfig-vim"
use(
{
use {
"jameshiew/nvim-magic",
config = function()
require("nvim-magic").setup(
@ -215,7 +207,7 @@ return require("packer").startup(
"MunifTanjim/nui.nvim"
}
}
)
use {
"mfussenegger/nvim-jdtls",
config = function()
@ -230,5 +222,15 @@ return require("packer").startup(
end,
requires = {"mfussenegger/nvim-dap"}
}
use {
"ms-jpq/coq_nvim",
branch = "coq",
config = function()
require "plugins/coq"
end,
setup = function()
vim.cmd("let g:coq_settings = { 'auto_start': v:true, 'keymaps': {'manual_completion': '<c-f>'} }")
end
}
end
)

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

@ -0,0 +1,82 @@
local remap = vim.api.nvim_set_keymap
local npairs = require("nvim-autopairs")
npairs.setup({map_bs = false})
vim.g.coq_settings = {
keymap = {recommended = false, manual_complete = "<c-f>"},
display = {
preview = {
positions = {
east = 1,
north = 2,
south = 3,
west = 4
}
},
icons = {
mappings = {
Text = "",
Method = "",
Function = "",
Constructor = "",
Field = "",
Variable = "",
Class = "",
Interface = "",
Module = "",
Property = "",
Unit = "",
Value = "",
Enum = "",
Keyword = "",
Snippet = "",
Color = "",
File = "",
Reference = "",
Folder = "",
EnumMember = "",
Constant = "",
Struct = "",
Event = "",
Operator = "",
TypeParameter = "",
Character = "",
Number = "",
Parameter = "",
String = ""
}
}
}
}
-- these mappings are coq recommended mappings unrelated to nvim-autopairs
remap("i", "<esc>", [[pumvisible() ? "<c-e><esc>" : "<esc>"]], {expr = true, noremap = true})
remap("i", "<c-c>", [[pumvisible() ? "<c-e><c-c>" : "<c-c>"]], {expr = true, noremap = true})
remap("i", "<tab>", [[pumvisible() ? "<c-n>" : "<tab>"]], {expr = true, noremap = true})
remap("i", "<s-tab>", [[pumvisible() ? "<c-p>" : "<bs>"]], {expr = true, noremap = true})
-- skip it, if you use another global object
_G.MUtils = {}
MUtils.CR = function()
if vim.fn.pumvisible() ~= 0 then
if vim.fn.complete_info({"selected"}).selected ~= -1 then
return npairs.esc("<c-y>")
else
return npairs.esc("<c-e>") .. npairs.autopairs_cr()
end
else
return npairs.autopairs_cr()
end
end
remap("i", "<cr>", "v:lua.MUtils.CR()", {expr = true, noremap = true})
MUtils.BS = function()
if vim.fn.pumvisible() ~= 0 and vim.fn.complete_info({"mode"}).mode == "eval" then
return npairs.esc("<c-e>") .. npairs.autopairs_bs()
else
return npairs.autopairs_bs()
end
end
remap("i", "<bs>", "v:lua.MUtils.BS()", {expr = true, noremap = true})

View File

@ -8,19 +8,19 @@ vim.lsp.handlers["textDocument/documentSymbol"] = require "lsputil.symbols".docu
vim.lsp.handlers["workspace/symbol"] = require "lsputil.symbols".workspace_handler
vim.fn.sign_define(
"LspDiagnosticsSignError",
"DiagnosticSignError",
{texthl = "LspDiagnosticsSignError", text = "", numhl = "LspDiagnosticsSignError"}
)
vim.fn.sign_define(
"LspDiagnosticsSignWarning",
"DiagnosticSignWarning",
{texthl = "LspDiagnosticsSignWarning", text = "", numhl = "LspDiagnosticsSignWarning"}
)
vim.fn.sign_define(
"LspDiagnosticsSignHint",
"DiagnosticSignHint",
{texthl = "LspDiagnosticsSignHint", text = "", numhl = "LspDiagnosticsSignHint"}
)
vim.fn.sign_define(
"LspDiagnosticsSignInformation",
"DiagnosticSignInformation",
{texthl = "LspDiagnosticsSignInformation", text = "", numhl = "LspDiagnosticsSignInformation"}
)