diff --git a/lua/plugs/nvim-lspconfig.lua b/lua/plugs/nvim-lspconfig.lua index 13d3ad9..96fdd2d 100644 --- a/lua/plugs/nvim-lspconfig.lua +++ b/lua/plugs/nvim-lspconfig.lua @@ -44,7 +44,19 @@ return { 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', '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()'}, + + }) + end + }, { -- lsp 下载器 @@ -53,6 +65,77 @@ return { require("mason").setup({}) end }, + { -- + 'simrat39/symbols-outline.nvim', + config = function () + local opts = { + highlight_hovered_item = true, + show_guides = true, + auto_preview = false, + position = 'right', + relative_width = true, + width = 25, + auto_close = false, + show_numbers = false, + show_relative_numbers = false, + show_symbol_details = true, + preview_bg_highlight = 'Pmenu', + autofold_depth = nil, + auto_unfold_hover = true, + fold_markers = { '', '' }, + wrap = false, + keymaps = { -- These keymaps can be a string or a table for multiple keys + close = {"", "q"}, + goto_location = "", + focus_location = "o", + hover_symbol = "", + toggle_preview = "K", + rename_symbol = "r", + code_actions = "a", + fold = "h", + unfold = "l", + fold_all = "W", + unfold_all = "E", + fold_reset = "R", + }, + lsp_blacklist = {}, + symbol_blacklist = {}, + symbols = { + File = { icon = "", hl = "@text.uri" }, + Module = { icon = "", hl = "@namespace" }, + Namespace = { icon = "", hl = "@namespace" }, + Package = { icon = "", hl = "@namespace" }, + Class = { icon = "𝓒", hl = "@type" }, + Method = { icon = "ƒ", hl = "@method" }, + Property = { icon = "", hl = "@method" }, + Field = { icon = "", hl = "@field" }, + Constructor = { icon = "", hl = "@constructor" }, + Enum = { icon = "ℰ", hl = "@type" }, + Interface = { icon = "ﰮ", hl = "@type" }, + Function = { icon = "", hl = "@function" }, + Variable = { icon = "", hl = "@constant" }, + Constant = { icon = "", hl = "@constant" }, + String = { icon = "𝓐", hl = "@string" }, + Number = { icon = "#", hl = "@number" }, + Boolean = { icon = "⊨", hl = "@boolean" }, + Array = { icon = "", hl = "@constant" }, + Object = { icon = "⦿", hl = "@type" }, + Key = { icon = "🔐", hl = "@type" }, + Null = { icon = "NULL", hl = "@type" }, + EnumMember = { icon = "", hl = "@field" }, + Struct = { icon = "𝓢", hl = "@type" }, + Event = { icon = "🗲", hl = "@type" }, + Operator = { icon = "+", hl = "@operator" }, + TypeParameter = { icon = "𝙏", hl = "@parameter" }, + Component = { icon = "", hl = "@function" }, + Fragment = { icon = "", hl = "@constant" }, + },} + require("symbols-outline").setup(opts) + G.map({ + {"n", "o", ":SymbolsOutline"}, + }) + end + }, { -- lsp补全 'hrsh7th/cmp-nvim-lsp', -- { name = 'nvim_lua' } @@ -127,80 +210,9 @@ return { }) end, }, - { -- - 'simrat39/symbols-outline.nvim', - config = function () - local opts = { - highlight_hovered_item = true, - show_guides = true, - auto_preview = false, - position = 'right', - relative_width = true, - width = 25, - auto_close = false, - show_numbers = false, - show_relative_numbers = false, - show_symbol_details = true, - preview_bg_highlight = 'Pmenu', - autofold_depth = nil, - auto_unfold_hover = true, - fold_markers = { '', '' }, - wrap = false, - keymaps = { -- These keymaps can be a string or a table for multiple keys - close = {"", "q"}, - goto_location = "", - focus_location = "o", - hover_symbol = "", - toggle_preview = "K", - rename_symbol = "r", - code_actions = "a", - fold = "h", - unfold = "l", - fold_all = "W", - unfold_all = "E", - fold_reset = "R", - }, - lsp_blacklist = {}, - symbol_blacklist = {}, - symbols = { - File = { icon = "", hl = "@text.uri" }, - Module = { icon = "", hl = "@namespace" }, - Namespace = { icon = "", hl = "@namespace" }, - Package = { icon = "", hl = "@namespace" }, - Class = { icon = "𝓒", hl = "@type" }, - Method = { icon = "ƒ", hl = "@method" }, - Property = { icon = "", hl = "@method" }, - Field = { icon = "", hl = "@field" }, - Constructor = { icon = "", hl = "@constructor" }, - Enum = { icon = "ℰ", hl = "@type" }, - Interface = { icon = "ﰮ", hl = "@type" }, - Function = { icon = "", hl = "@function" }, - Variable = { icon = "", hl = "@constant" }, - Constant = { icon = "", hl = "@constant" }, - String = { icon = "𝓐", hl = "@string" }, - Number = { icon = "#", hl = "@number" }, - Boolean = { icon = "⊨", hl = "@boolean" }, - Array = { icon = "", hl = "@constant" }, - Object = { icon = "⦿", hl = "@type" }, - Key = { icon = "🔐", hl = "@type" }, - Null = { icon = "NULL", hl = "@type" }, - EnumMember = { icon = "", hl = "@field" }, - Struct = { icon = "𝓢", hl = "@type" }, - Event = { icon = "🗲", hl = "@type" }, - Operator = { icon = "+", hl = "@operator" }, - TypeParameter = { icon = "𝙏", hl = "@parameter" }, - Component = { icon = "", hl = "@function" }, - Fragment = { icon = "", hl = "@constant" }, - },} - require("symbols-outline").setup(opts) - G.map({ - {"n", "o", ":SymbolsOutline"}, - }) - end - }, + { -- 语法高亮 -- - 'nvim-treesitter/nvim-treesitter', config = function() require'nvim-treesitter.configs'.setup{ @@ -231,5 +243,9 @@ return { } end }, - } + }, + { + "" + }, } +