feat(lualine): better lualine with git status, diagnostics and navic lsp information (#15)

This commit is contained in:
Andreas Gerlach 2023-01-06 07:27:28 +01:00 committed by GitHub
parent 6bfba2d669
commit d74759de76
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 40 additions and 7 deletions

View file

@ -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" },

View file

@ -7,6 +7,11 @@ local settings = {
Hint = "",
Info = "",
},
git = {
added = "",
modified = "",
removed = "",
},
kinds = {
Class = "",
Color = "",

View file

@ -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

View file

@ -69,13 +69,36 @@ return {
{
"nvim-lualine/lualine.nvim",
event = "VeryLazy",
config = {
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
{