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
}, },
@ -66,10 +65,10 @@ return {
require("mason").setup({}) require("mason").setup({})
end end
}, },
{ -- { --
'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,
auto_preview = false, auto_preview = false,
@ -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,12 +129,13 @@ 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) }
G.map({ require("symbols-outline").setup(opts)
{"n", "<leader>o", ":SymbolsOutline<cr>"}, G.map({
}) { "n", "<leader>o", ":SymbolsOutline<cr>" },
end })
end
}, },
{ {
-- lsp补全 -- lsp补全
@ -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,47 +206,46 @@ return {
} }
cmp.setup.cmdline('/', { cmp.setup.cmdline('/', {
view = { view = {
entries = {name = 'wildmenu', separator = '|' } entries = { name = 'wildmenu', separator = '|' }
}, },
}) })
end, end,
}, },
{ {
-- 语法高亮 -- -- 语法高亮 --
'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,
auto_install = true, auto_install = true,
highlight = { highlight = {
enable = true, enable = true,
disable = function(lang, buf) disable = function(lang, buf)
local max_filesize = 100 * 1024 -- 100 KB local max_filesize = 100 * 1024 -- 100 KB
local ok, stats = pcall(G.loop.fs_stat, G.api.nvim_buf_get_name(buf)) local ok, stats = pcall(G.loop.fs_stat, G.api.nvim_buf_get_name(buf))
if ok and stats and stats.size > max_filesize then if ok and stats and stats.size > max_filesize then
return true return true
end end
end, end,
additional_vim_regex_highlighting = false, additional_vim_regex_highlighting = false,
}, },
parsers = { parsers = {
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"
}
}
} }
} }
} end
} },
end
},
}, },
{ {
"" ""
}, },
} }