update
This commit is contained in:
parent
f67a85dfb1
commit
d6950258d7
@ -46,6 +46,7 @@ return {
|
|||||||
require 'lspconfig'.bashls.setup(require('lsp.bash'))
|
require 'lspconfig'.bashls.setup(require('lsp.bash'))
|
||||||
require 'lspconfig'.pyright.setup(require('lsp.pyright'))
|
require 'lspconfig'.pyright.setup(require('lsp.pyright'))
|
||||||
G.map({
|
G.map({
|
||||||
|
|
||||||
{ 'n', '<leader>rn', '<cmd>lua vim.lsp.buf.rename()<CR>' },
|
{ 'n', '<leader>rn', '<cmd>lua vim.lsp.buf.rename()<CR>' },
|
||||||
|
|
||||||
{ 'n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>' },
|
{ 'n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>' },
|
||||||
@ -59,6 +60,21 @@ return {
|
|||||||
end
|
end
|
||||||
|
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
-- lsp
|
||||||
|
"williamboman/mason-lspconfig.nvim",
|
||||||
|
config = function()
|
||||||
|
require("mason-lspconfig").setup({
|
||||||
|
ensure_installed = {
|
||||||
|
"clangd",
|
||||||
|
"bashls",
|
||||||
|
"pyright",
|
||||||
|
"lua_ls"
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
end
|
||||||
|
},
|
||||||
{
|
{
|
||||||
-- lsp 下载器
|
-- lsp 下载器
|
||||||
"williamboman/mason.nvim",
|
"williamboman/mason.nvim",
|
||||||
@ -135,7 +151,6 @@ return {
|
|||||||
require("symbols-outline").setup(opts)
|
require("symbols-outline").setup(opts)
|
||||||
G.map({
|
G.map({
|
||||||
{ "n", "<leader>o", "<cmd>SymbolsOutline<cr>", { noremap = true } },
|
{ "n", "<leader>o", "<cmd>SymbolsOutline<cr>", { noremap = true } },
|
||||||
{ "v", "<cs-o>", "<cmd>SymbolsOutline<cr>", { noremap = true } },
|
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
},
|
},
|
||||||
@ -152,7 +167,7 @@ return {
|
|||||||
"hrsh7th/nvim-cmp",
|
"hrsh7th/nvim-cmp",
|
||||||
config = function()
|
config = function()
|
||||||
local cmp = require('cmp')
|
local cmp = require('cmp')
|
||||||
local lspkind = require('lspkind')
|
-- local lspkind = require('lspkind')
|
||||||
cmp.setup {
|
cmp.setup {
|
||||||
snippet = {
|
snippet = {
|
||||||
expand = function(args)
|
expand = function(args)
|
||||||
@ -167,8 +182,20 @@ return {
|
|||||||
{ name = 'cmdline' },
|
{ name = 'cmdline' },
|
||||||
}),
|
}),
|
||||||
mapping = cmp.mapping.preset.insert({
|
mapping = cmp.mapping.preset.insert({
|
||||||
['<CR>'] = cmp.mapping.confirm({ select = false }),
|
["<CR>"] = cmp.mapping({
|
||||||
["<c-n>"] = cmp.mapping(function(fallback)
|
i = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true }),
|
||||||
|
c = function(fallback)
|
||||||
|
if cmp.visible() then
|
||||||
|
cmp.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true })
|
||||||
|
else
|
||||||
|
fallback()
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
}),
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
["<Tab>"] = cmp.mapping(function(fallback)
|
||||||
if cmp.visible() then
|
if cmp.visible() then
|
||||||
cmp.select_next_item()
|
cmp.select_next_item()
|
||||||
elseif vim.fn["vsnip#available"](1) == 1 then
|
elseif vim.fn["vsnip#available"](1) == 1 then
|
||||||
@ -180,13 +207,14 @@ return {
|
|||||||
end
|
end
|
||||||
end, { "i", "s" }),
|
end, { "i", "s" }),
|
||||||
|
|
||||||
["<n-p>"] = cmp.mapping(function()
|
["<S-Tab>"] = cmp.mapping(function()
|
||||||
if cmp.visible() then
|
if cmp.visible() then
|
||||||
cmp.select_prev_item()
|
cmp.select_prev_item()
|
||||||
elseif vim.fn["vsnip#jumpable"](-1) == 1 then
|
elseif vim.fn["vsnip#jumpable"](-1) == 1 then
|
||||||
feedkey("<Plug>(vsnip-jump-prev)", "")
|
feedkey("<Plug>(vsnip-jump-prev)", "")
|
||||||
end
|
end
|
||||||
end, { "i", "s" }),
|
end, { "i", "s" }),
|
||||||
|
|
||||||
}),
|
}),
|
||||||
window = {
|
window = {
|
||||||
completion = {
|
completion = {
|
||||||
@ -194,20 +222,32 @@ return {
|
|||||||
col_offset = -3,
|
col_offset = -3,
|
||||||
side_padding = 0,
|
side_padding = 0,
|
||||||
border = "rounded",
|
border = "rounded",
|
||||||
scrollbar = true,
|
scrollbar = false,
|
||||||
},
|
},
|
||||||
documentation = {
|
documentation = {
|
||||||
winhighlight = "Normal:Pmenu,FloatBorder:Pmenu,Search:None",
|
winhighlight = "Normal:Pmenu,FloatBorder:Pmenu,Search:None",
|
||||||
border = "rounded",
|
border = "rounded",
|
||||||
scrollbar = true,
|
scrollbar = false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
fomatting = {
|
fomatting = {
|
||||||
fields = { "kind", "abbr", "menu" },
|
fields = { "kind", "abbr", "menu" },
|
||||||
format = function(entry, vim_item)
|
format = function(entry, vim_item)
|
||||||
local kind = require("lspkind").cmp_format({ mode = "symbol_text", maxwidth = 50 })(entry, vim_item)
|
local kind = require("lspkind").cmp_format({
|
||||||
|
mode = "symbol_text",
|
||||||
|
maxwidth = 50,
|
||||||
|
-- before = function(entry, vim_item)
|
||||||
|
-- vim_item.kind = kind_icons[vim_item.kind]
|
||||||
|
-- vim_item.menu = ({
|
||||||
|
-- buffer = "[Buffer]",
|
||||||
|
-- nvim_lsp = "[LSP]",
|
||||||
|
-- })[entry.source.name]
|
||||||
|
-- return vim_item
|
||||||
|
-- end,
|
||||||
|
})(entry, vim_item)
|
||||||
local strings = vim.split(kind.kind, "%s", { trimempty = true })
|
local strings = vim.split(kind.kind, "%s", { trimempty = true })
|
||||||
|
kind.kind = kind_icons[vim_item.kind]
|
||||||
kind.kind = " " .. (strings[1] or "") .. " "
|
kind.kind = " " .. (strings[1] or "") .. " "
|
||||||
kind.menu = " (" .. (strings[2] or "") .. ")"
|
kind.menu = " (" .. (strings[2] or "") .. ")"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user