This commit is contained in:
newbie 2023-11-27 18:33:57 +08:00
parent d5927286ab
commit be12cae2f9

View File

@ -39,23 +39,22 @@ return {
{ {
-- lsp的config -- lsp的config
"neovim/nvim-lspconfig", "neovim/nvim-lspconfig",
config = function () config = function()
require'lspconfig'.lua_ls.setup(require('lsp.lua')) require 'lspconfig'.lua_ls.setup(require('lsp.lua'))
require'lspconfig'.clangd.setup(require('lsp.c')) require 'lspconfig'.clangd.setup(require('lsp.c'))
require'lspconfig'.bash_ls.setup(require('lsp.bash')) -- require'lspconfig'.bash_ls.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>' },
{'n', 'gh', '<cmd>lua vim.lsp.buf.hover()<CR>'}, { 'n', 'gh', '<cmd>lua vim.lsp.buf.hover()<CR>' },
{'n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>'}, { 'n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>' },
{'n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>'}, { 'n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>' },
{'n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>'}, { 'n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>' },
{'n', '<c-s-i>', '<cmd>lua vim.lsp.buf.formatting()<CR>'}, { 'n', '<c-I>', '<cmd>lua vim.lsp.buf.format()<CR>' },
}) })
end end
}, },
@ -68,7 +67,7 @@ return {
}, },
{ -- { --
'simrat39/symbols-outline.nvim', 'simrat39/symbols-outline.nvim',
config = function () config = function()
local opts = { local opts = {
highlight_hovered_item = true, highlight_hovered_item = true,
show_guides = true, show_guides = true,
@ -86,7 +85,7 @@ return {
fold_markers = { '', '' }, fold_markers = { '', '' },
wrap = false, wrap = false,
keymaps = { -- These keymaps can be a string or a table for multiple keys keymaps = { -- These keymaps can be a string or a table for multiple keys
close = {"<Esc>", "q"}, close = { "<Esc>", "q" },
goto_location = "<Cr>", goto_location = "<Cr>",
focus_location = "o", focus_location = "o",
hover_symbol = "<C-space>", hover_symbol = "<C-space>",
@ -130,10 +129,11 @@ return {
TypeParameter = { icon = "𝙏", hl = "@parameter" }, TypeParameter = { icon = "𝙏", hl = "@parameter" },
Component = { icon = "", hl = "@function" }, Component = { icon = "", hl = "@function" },
Fragment = { icon = "", hl = "@constant" }, Fragment = { icon = "", hl = "@constant" },
},} },
}
require("symbols-outline").setup(opts) require("symbols-outline").setup(opts)
G.map({ G.map({
{"n", "<leader>o", ":SymbolsOutline<cr>"}, { "n", "<leader>o", ":SymbolsOutline<cr>" },
}) })
end end
}, },
@ -158,7 +158,7 @@ return {
end, end,
}, },
sources = cmp.config.sources({ sources = cmp.config.sources({
{ name = 'vnsip'}, { name = 'vnsip' },
{ name = 'nvim_lsp' }, { name = 'nvim_lsp' },
{ name = 'buffer' }, { name = 'buffer' },
{ name = 'path' }, { name = 'path' },
@ -193,7 +193,7 @@ return {
with_text = true, with_text = true,
maxwidth = 50, maxwidth = 50,
mode = 'symbol', mode = 'symbol',
before = function (entry, vim_item) before = function(entry, vim_item)
vim_item.kind = kind_icons[vim_item.kind] vim_item.kind = kind_icons[vim_item.kind]
vim_item.menu = ({ vim_item.menu = ({
buffer = "[Buffer]", buffer = "[Buffer]",
@ -206,7 +206,7 @@ return {
} }
cmp.setup.cmdline('/', { cmp.setup.cmdline('/', {
view = { view = {
entries = {name = 'wildmenu', separator = '|' } entries = { name = 'wildmenu', separator = '|' }
}, },
}) })
end, end,
@ -216,7 +216,7 @@ return {
-- 语法高亮 -- -- 语法高亮 --
'nvim-treesitter/nvim-treesitter', 'nvim-treesitter/nvim-treesitter',
config = function() config = function()
require'nvim-treesitter.configs'.setup{ require 'nvim-treesitter.configs'.setup {
ensure_installed = {}, ensure_installed = {},
indent = { enable = true }, indent = { enable = true },
sync_install = false, sync_install = false,
@ -236,7 +236,7 @@ return {
html = { html = {
install_info = { install_info = {
url = "https://github.com/ikatyang/tree-sitter-vue", url = "https://github.com/ikatyang/tree-sitter-vue",
files = {"src/parser.c"}, files = { "src/parser.c" },
branch = "main" branch = "main"
} }
} }
@ -249,4 +249,3 @@ return {
"" ""
}, },
} }