Merge branch 'master' of gitea.suda.codes:sudacode/nvim
This commit is contained in:
commit
d34b2da189
@ -20,6 +20,8 @@ require("null-ls").setup({
|
||||
null_ls.builtins.code_actions.eslint, null_ls.builtins.diagnostics.tsc,
|
||||
null_ls.builtins.diagnostics.cppcheck,
|
||||
null_ls.builtins.diagnostics.gitlint,
|
||||
null_ls.builtins.diagnostics.eslint
|
||||
.with({ cmd = "eslint-language-server" }),
|
||||
null_ls.builtins.diagnostics.jsonlint,
|
||||
require("null-ls").builtins.diagnostics.luacheck,
|
||||
null_ls.builtins.diagnostics.markdownlint,
|
||||
|
@ -14,13 +14,13 @@ local has_words_before = function()
|
||||
end
|
||||
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
|
||||
return col ~= 0 and
|
||||
vim.api.nvim_buf_get_text(0, line - 1, 0, line - 1, col, {})[1]:match(
|
||||
"^%s*$") == nil
|
||||
vim.api.nvim_buf_get_text(0, line - 1, 0, line - 1, col, {})[1]:match(
|
||||
"^%s*$") == nil
|
||||
end
|
||||
|
||||
lspkind.init({ symbol_map = { Copilot = "" } })
|
||||
lspkind.init({symbol_map = {Copilot = ""}})
|
||||
|
||||
vim.api.nvim_set_hl(0, "CmpItemKindCopilot", { fg = "#6CC644" })
|
||||
vim.api.nvim_set_hl(0, "CmpItemKindCopilot", {fg = "#6CC644"})
|
||||
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
@ -43,7 +43,7 @@ cmp.setup({
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { 'i', 's' }),
|
||||
end, {'i', 's'}),
|
||||
['<C-n>'] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
@ -54,7 +54,7 @@ cmp.setup({
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { 'i', 's' }),
|
||||
end, {'i', 's'}),
|
||||
['<C-d>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||
['<C-Space>'] = cmp.mapping.complete(),
|
||||
@ -74,7 +74,7 @@ cmp.setup({
|
||||
-- end, { "i", "s" }),
|
||||
["<Tab>"] = vim.schedule_wrap(function(fallback)
|
||||
if cmp.visible() and has_words_before() then
|
||||
cmp.select_next_item({ behavior = cmp.SelectBehavior.Select })
|
||||
cmp.select_next_item({behavior = cmp.SelectBehavior.Select})
|
||||
elseif luasnip.expand_or_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
else
|
||||
@ -83,7 +83,7 @@ cmp.setup({
|
||||
end),
|
||||
['<S-Tab>'] = cmp.mapping(function()
|
||||
if cmp.visible() then cmp.select_prev_item() end
|
||||
end, { "i", "s" })
|
||||
end, {"i", "s"})
|
||||
},
|
||||
window = {
|
||||
completion = {
|
||||
@ -106,7 +106,7 @@ cmp.setup({
|
||||
formatting = {
|
||||
-- options: 'text', 'text_symbol', 'symbol_text', 'symbol'
|
||||
-- mode = 'symbol_text',
|
||||
fields = { "kind", "abbr", "menu" },
|
||||
fields = {"kind", "abbr", "menu"},
|
||||
format = function(entry, vim_item)
|
||||
local kind = require("lspkind").cmp_format({
|
||||
mode = "symbol_text",
|
||||
@ -139,7 +139,7 @@ cmp.setup({
|
||||
TypeParameter = ""
|
||||
}
|
||||
})(entry, vim_item)
|
||||
local strings = vim.split(kind.kind, "%s", { trimempty = true })
|
||||
local strings = vim.split(kind.kind, "%s", {trimempty = true})
|
||||
kind.kind = " " .. strings[1] .. " "
|
||||
kind.menu = " (" .. strings[2] .. ")"
|
||||
|
||||
@ -157,13 +157,13 @@ cmp.setup({
|
||||
-- })
|
||||
},
|
||||
sources = cmp.config.sources({
|
||||
{ name = "copilot", group_index = 2 }, { name = "path", group_index = 2 },
|
||||
{ name = 'nvim_lsp', group_index = 2 },
|
||||
{ name = 'nvim_lsp_signature_help', group_index = 2 },
|
||||
{ name = 'nvim_lsp_document_symbol', group_index = 2 },
|
||||
{ name = 'vim-dadbod-completion', group_index = 2 },
|
||||
{ name = 'neorg', group_index = 2 }, -- For luasnip users.
|
||||
{ name = 'luasnip', group_index = 2 }, -- For luasnip users.
|
||||
{name = "copilot", group_index = 2}, {name = "path", group_index = 2},
|
||||
{name = 'nvim_lsp', group_index = 2},
|
||||
{name = 'nvim_lsp_signature_help', group_index = 2},
|
||||
{name = 'nvim_lsp_document_symbol', group_index = 2},
|
||||
{name = 'vim-dadbod-completion', group_index = 2},
|
||||
{name = 'neorg', group_index = 2}, -- For luasnip users.
|
||||
{name = 'luasnip', group_index = 2}, -- For luasnip users.
|
||||
{
|
||||
name = 'buffer',
|
||||
option = {
|
||||
@ -178,7 +178,7 @@ cmp.setup({
|
||||
}
|
||||
-- { name = 'ultisnips' }, -- For ultisnips users.
|
||||
-- { name = 'snippy' }, -- For snippy users.
|
||||
}, { { name = 'buffer' } }),
|
||||
}, {{name = 'buffer'}}),
|
||||
sorting = {
|
||||
priority_weight = 2,
|
||||
comparators = {
|
||||
@ -203,13 +203,13 @@ cmp.setup({
|
||||
|
||||
cmp.setup.cmdline('/', {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = { { name = 'buffer' } }
|
||||
sources = {{name = 'buffer'}}
|
||||
})
|
||||
|
||||
cmp.setup.cmdline(':', {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = cmp.config.sources({ { name = 'path' } }, {
|
||||
{ name = 'cmdline', option = { ignore_cmds = { 'Man', '!' } } }
|
||||
sources = cmp.config.sources({{name = 'path'}}, {
|
||||
{name = 'cmdline', option = {ignore_cmds = {'Man', '!'}}}
|
||||
})
|
||||
})
|
||||
|
||||
@ -217,6 +217,7 @@ local servers = {
|
||||
'bashls', 'pyright', 'jsonls', 'yamlls', 'vimls', 'dotls', 'dockerls',
|
||||
'html', 'cssls', 'lua_ls', 'eslint', 'tsserver', 'angularls', 'ansiblels'
|
||||
}
|
||||
|
||||
for _, lsp in ipairs(servers) do
|
||||
if lsp == 'lua_ls' then
|
||||
lspconfig[lsp].setup {
|
||||
@ -249,11 +250,11 @@ for _, lsp in ipairs(servers) do
|
||||
}
|
||||
}
|
||||
else
|
||||
lspconfig[lsp].setup { capabilities = capabilities }
|
||||
lspconfig[lsp].setup {capabilities = capabilities}
|
||||
end
|
||||
end
|
||||
|
||||
cmp.event:on("menu_opened",
|
||||
function() vim.b.copilot_suggestion_hidden = true end)
|
||||
function() vim.b.copilot_suggestion_hidden = true end)
|
||||
cmp.event:on("menu_closed",
|
||||
function() vim.b.copilot_suggestion_hidden = false end)
|
||||
function() vim.b.copilot_suggestion_hidden = false end)
|
||||
|
Loading…
Reference in New Issue
Block a user