update
This commit is contained in:
commit
22be77e7e6
@ -365,7 +365,7 @@ require('packer').startup(function(use)
|
||||
vim.g.doom_one_plugin_startify = true
|
||||
vim.g.doom_one_plugin_whichkey = true
|
||||
vim.g.doom_one_plugin_indent_blankline = true
|
||||
vim.g.doom_one_plugin_vim_illuminate = true
|
||||
vim.g.doom_one_plugin_vim_illuminate = false
|
||||
vim.g.doom_one_plugin_lspsaga = false
|
||||
end,
|
||||
config = function()
|
||||
|
@ -6,31 +6,7 @@ local lspconfig = require('lspconfig')
|
||||
local luasnip = require 'luasnip'
|
||||
local highlight = require('cmp.utils.highlight')
|
||||
|
||||
local highlight_symbol_under_cursor = function()
|
||||
-- if the client has not resolved the document highlight capability, then
|
||||
-- don't do anything
|
||||
if not vim.lsp.buf.document_highlight then return end
|
||||
vim.cmd [[
|
||||
hi! LspReferenceRead cterm=bold ctermbg=red guibg=LightYellow
|
||||
hi! LspReferenceText cterm=bold ctermbg=red guibg=LightYellow
|
||||
hi! LspReferenceWrite cterm=bold ctermbg=red guibg=LightYellow
|
||||
]]
|
||||
vim.api.nvim_create_augroup('lsp_document_highlight', { clear = false })
|
||||
vim.api.nvim_clear_autocmds({
|
||||
buffer = bufnr,
|
||||
group = 'lsp_document_highlight'
|
||||
})
|
||||
vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, {
|
||||
group = 'lsp_document_highlight',
|
||||
buffer = bufnr,
|
||||
callback = vim.lsp.buf.document_highlight
|
||||
})
|
||||
vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, {
|
||||
group = 'lsp_document_highlight',
|
||||
buffer = bufnr,
|
||||
callback = vim.lsp.buf.clear_references
|
||||
})
|
||||
end
|
||||
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||
|
||||
local has_words_before = function()
|
||||
if vim.api.nvim_buf_get_option(0, "buftype") == "prompt" then
|
||||
@ -42,9 +18,9 @@ local has_words_before = function()
|
||||
"^%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 = {
|
||||
@ -67,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()
|
||||
@ -78,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(),
|
||||
@ -98,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
|
||||
@ -107,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 = {
|
||||
@ -130,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",
|
||||
@ -163,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] .. ")"
|
||||
|
||||
@ -181,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 = {
|
||||
@ -202,7 +178,7 @@ cmp.setup({
|
||||
}
|
||||
-- { name = 'ultisnips' }, -- For ultisnips users.
|
||||
-- { name = 'snippy' }, -- For snippy users.
|
||||
}, { { name = 'buffer' } }),
|
||||
}, {{name = 'buffer'}}),
|
||||
sorting = {
|
||||
priority_weight = 2,
|
||||
comparators = {
|
||||
@ -227,18 +203,16 @@ 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', '!'}}}
|
||||
})
|
||||
})
|
||||
|
||||
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||
|
||||
local servers = {
|
||||
'bashls', 'jedi_language_server', 'jsonls', 'yamlls', 'vimls', 'dotls',
|
||||
'dockerls', 'html', 'cssls', 'lua_ls'
|
||||
@ -252,10 +226,7 @@ for _, lsp in ipairs(servers) do
|
||||
callSnippet = "Replace"
|
||||
}
|
||||
else
|
||||
lspconfig[lsp].setup {
|
||||
-- on_attach = highlight_symbol_under_cursor(),
|
||||
capabilities = capabilities
|
||||
}
|
||||
lspconfig[lsp].setup {capabilities = capabilities}
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -20,7 +20,7 @@ ts.setup({
|
||||
-- map actions.which_key to <C-h> (default: <C-/>)
|
||||
-- actions.which_key shows the mappings for your picker,
|
||||
-- e.g. git_{create, delete, ...}_branch for the git_branches picker
|
||||
-- ["<C-/?>"] = "which_key"
|
||||
["<C-/>"] = "which_key"
|
||||
}
|
||||
},
|
||||
file_ignore_patterns = { "^node_modules/", "^env/", "^__pycache__/" }
|
||||
|
Loading…
Reference in New Issue
Block a user