From be12cae2f9dc2a65addde467f0b2007390d433ee Mon Sep 17 00:00:00 2001 From: newbie Date: Mon, 27 Nov 2023 18:33:57 +0800 Subject: [PATCH] update --- lua/plugs/nvim-lspconfig.lua | 115 +++++++++++++++++------------------ 1 file changed, 57 insertions(+), 58 deletions(-) diff --git a/lua/plugs/nvim-lspconfig.lua b/lua/plugs/nvim-lspconfig.lua index 61ea2d4..ca04028 100644 --- a/lua/plugs/nvim-lspconfig.lua +++ b/lua/plugs/nvim-lspconfig.lua @@ -39,23 +39,22 @@ return { { -- lsp的config "neovim/nvim-lspconfig", - config = function () - require'lspconfig'.lua_ls.setup(require('lsp.lua')) - require'lspconfig'.clangd.setup(require('lsp.c')) - require'lspconfig'.bash_ls.setup(require('lsp.bash')) - require'lspconfig'.pyright.setup(require('lsp.pyright')) + config = function() + require 'lspconfig'.lua_ls.setup(require('lsp.lua')) + require 'lspconfig'.clangd.setup(require('lsp.c')) + -- require'lspconfig'.bash_ls.setup(require('lsp.bash')) + require 'lspconfig'.pyright.setup(require('lsp.pyright')) G.map({ - {'n', 'rn', 'lua vim.lsp.buf.rename()'}, + { 'n', 'rn', 'lua vim.lsp.buf.rename()' }, - {'n', 'gd', 'lua vim.lsp.buf.definition()'}, - {'n', 'gh', 'lua vim.lsp.buf.hover()'}, - {'n', 'gD', 'lua vim.lsp.buf.declaration()'}, - {'n', 'gi', 'lua vim.lsp.buf.implementation()'}, - {'n', 'gr', 'lua vim.lsp.buf.references()'}, - {'n', '', 'lua vim.lsp.buf.formatting()'}, + { 'n', 'gd', 'lua vim.lsp.buf.definition()' }, + { 'n', 'gh', 'lua vim.lsp.buf.hover()' }, + { 'n', 'gD', 'lua vim.lsp.buf.declaration()' }, + { 'n', 'gi', 'lua vim.lsp.buf.implementation()' }, + { 'n', 'gr', 'lua vim.lsp.buf.references()' }, + { 'n', '', 'lua vim.lsp.buf.format()' }, }) - end }, @@ -66,10 +65,10 @@ return { require("mason").setup({}) end }, - { -- - 'simrat39/symbols-outline.nvim', - config = function () - local opts = { + { -- + 'simrat39/symbols-outline.nvim', + config = function() + local opts = { highlight_hovered_item = true, show_guides = true, auto_preview = false, @@ -86,7 +85,7 @@ return { fold_markers = { '', '' }, wrap = false, keymaps = { -- These keymaps can be a string or a table for multiple keys - close = {"", "q"}, + close = { "", "q" }, goto_location = "", focus_location = "o", hover_symbol = "", @@ -130,12 +129,13 @@ return { TypeParameter = { icon = "𝙏", hl = "@parameter" }, Component = { icon = "", hl = "@function" }, Fragment = { icon = "", hl = "@constant" }, - },} - require("symbols-outline").setup(opts) - G.map({ - {"n", "o", ":SymbolsOutline"}, - }) - end + }, + } + require("symbols-outline").setup(opts) + G.map({ + { "n", "o", ":SymbolsOutline" }, + }) + end }, { -- lsp补全 @@ -158,7 +158,7 @@ return { end, }, sources = cmp.config.sources({ - { name = 'vnsip'}, + { name = 'vnsip' }, { name = 'nvim_lsp' }, { name = 'buffer' }, { name = 'path' }, @@ -193,7 +193,7 @@ return { with_text = true, maxwidth = 50, mode = 'symbol', - before = function (entry, vim_item) + before = function(entry, vim_item) vim_item.kind = kind_icons[vim_item.kind] vim_item.menu = ({ buffer = "[Buffer]", @@ -206,47 +206,46 @@ return { } cmp.setup.cmdline('/', { view = { - entries = {name = 'wildmenu', separator = '|' } + entries = { name = 'wildmenu', separator = '|' } }, }) end, - }, + }, - { - -- 语法高亮 -- - 'nvim-treesitter/nvim-treesitter', - config = function() - require'nvim-treesitter.configs'.setup{ - ensure_installed = {}, - indent = { enable = true }, - sync_install = false, - auto_install = true, - highlight = { - enable = true, - disable = function(lang, buf) - local max_filesize = 100 * 1024 -- 100 KB - 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 + { + -- 语法高亮 -- + 'nvim-treesitter/nvim-treesitter', + config = function() + require 'nvim-treesitter.configs'.setup { + ensure_installed = {}, + indent = { enable = true }, + sync_install = false, + auto_install = true, + highlight = { + enable = true, + disable = function(lang, buf) + local max_filesize = 100 * 1024 -- 100 KB + 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 return true - end - end, - additional_vim_regex_highlighting = false, - }, - parsers = { - html = { - install_info = { - url = "https://github.com/ikatyang/tree-sitter-vue", - files = {"src/parser.c"}, - branch = "main" + end + end, + additional_vim_regex_highlighting = false, + }, + parsers = { + html = { + install_info = { + url = "https://github.com/ikatyang/tree-sitter-vue", + files = { "src/parser.c" }, + branch = "main" + } + } } } - } - } - end - }, + end + }, }, { "" }, } -