diff --git a/lazy-lock.json b/lazy-lock.json index c49941c8..737e3da5 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -12,7 +12,7 @@ "friendly-snippets": { "branch": "main", "commit": "484fb38b8f493ceeebf4e6fc499ebe41e10aae25" }, "gitsigns.nvim": { "branch": "main", "commit": "bb808fc7376ed7bac0fbe8f47b83d4bf01738167" }, "indent-blankline.nvim": { "branch": "master", "commit": "db7cbcb40cc00fc5d6074d7569fb37197705e7f6" }, - "lazy.nvim": { "branch": "main", "commit": "e89e938991701cef7b9ace1913a7251c4c0fa46c" }, + "lazy.nvim": { "branch": "main", "commit": "2ef44e2dee112ba7b83bdfca98f6c07967d65484" }, "leap.nvim": { "branch": "main", "commit": "a968ab4250840dc879e805f918b4f3b892310a12" }, "lualine.nvim": { "branch": "master", "commit": "d8c392dd75778d6258da4e7c55522e94ac389732" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "aa25b4153d2f2636c3b3a8c8360349d2b29e7ae3" }, @@ -32,6 +32,7 @@ "nvim-bufferline.lua": { "branch": "main", "commit": "028a87933d99f8bb88f2f70a4def3ff9574f3594" }, "nvim-cmp": { "branch": "main", "commit": "983453e32cb35533a119725883c04436d16c0120" }, "nvim-lspconfig": { "branch": "master", "commit": "22c87d6f48c4fb1daf33476450d0b14a64230809" }, + "nvim-navic": { "branch": "master", "commit": "7a2b823152fe4de65ee7925b0e32d26ed73bc57c" }, "nvim-notify": { "branch": "master", "commit": "b005821516f1f37801a73067afd1cef2dbc4dfe8" }, "nvim-spectre": { "branch": "master", "commit": "68ea562b485b6593e325e7916c3bd6e833d433e7" }, "nvim-treesitter": { "branch": "master", "commit": "69388e84c34d40c3d5c7d2f310db13276f2179e1" }, diff --git a/lua/lazyvim/config/settings.lua b/lua/lazyvim/config/settings.lua index d8cb2631..490e8786 100644 --- a/lua/lazyvim/config/settings.lua +++ b/lua/lazyvim/config/settings.lua @@ -7,6 +7,11 @@ local settings = { Hint = " ", Info = " ", }, + git = { + added = " ", + modified = "柳", + removed = " ", + }, kinds = { Class = " ", Color = " ", diff --git a/lua/lazyvim/plugins/lsp/init.lua b/lua/lazyvim/plugins/lsp/init.lua index 2b81fad4..1d8bf13a 100644 --- a/lua/lazyvim/plugins/lsp/init.lua +++ b/lua/lazyvim/plugins/lsp/init.lua @@ -9,6 +9,7 @@ return { "mason.nvim", "williamboman/mason-lspconfig.nvim", "hrsh7th/cmp-nvim-lsp", + "SmiteshP/nvim-navic", }, ---@type lspconfig.options servers = nil, @@ -17,6 +18,9 @@ return { require("lazyvim.util").on_attach(function(client, buffer) require("lazyvim.plugins.lsp.format").on_attach(client, buffer) require("lazyvim.plugins.lsp.keymaps").on_attach(client, buffer) + if client.server_capabilities.documentSymbolProvider then + require("nvim-navic").attach(client, buffer) + end end) -- diagnostics diff --git a/lua/lazyvim/plugins/ui.lua b/lua/lazyvim/plugins/ui.lua index d9461172..628b1fcc 100644 --- a/lua/lazyvim/plugins/ui.lua +++ b/lua/lazyvim/plugins/ui.lua @@ -69,12 +69,35 @@ return { { "nvim-lualine/lualine.nvim", event = "VeryLazy", - config = { - options = { - globalstatus = true, - disabled_filetypes = { statusline = { "lazy", "alpha" } }, - }, - }, + config = function() + local navic = require("nvim-navic") + local lualine = require("lualine") + local symbols = require("lazyvim.config.settings") + lualine.setup({ + options = { + globalstatus = true, + disabled_filetypes = { statusline = { "lazy", "alpha" } }, + }, + sections = { + lualine_a = { "mode" }, + lualine_b = { + { "branch" }, + { + "diff", + symbols = { added = symbols.icons.git.added, modified = symbols.icons.git.modified, removed = symbols.icons.git.removed }, -- changes diff symbols + }, + }, + lualine_c = { + { + "diagnostics", + symbols = { error = symbols.icons.diagnostics.Error, warn = symbols.icons.diagnostics.Warn, info = symbols.icons.diagnostics.Info, hint = symbols.icons.diagnostics.Hint } + }, + { "filename", padding = { left = 1, right = 1 } }, + { navic.get_location, cond = navic.is_available } + }, + } + }) + end }, -- indent guides for Neovim