diff --git a/lua/lazyvim/config/options.lua b/lua/lazyvim/config/options.lua index a1150151..1531ef53 100644 --- a/lua/lazyvim/config/options.lua +++ b/lua/lazyvim/config/options.lua @@ -28,6 +28,9 @@ vim.g.lazygit_config = true -- Hide deprecation warnings vim.g.deprecation_warnings = false +-- Show the current document symbols location from Trouble in lualine +vim.g.trouble_lualine = true + local opt = vim.opt opt.autowrite = true -- Enable auto write diff --git a/lua/lazyvim/plugins/ui.lua b/lua/lazyvim/plugins/ui.lua index 94d72a12..190544a2 100644 --- a/lua/lazyvim/plugins/ui.lua +++ b/lua/lazyvim/plugins/ui.lua @@ -128,18 +128,7 @@ return { vim.o.laststatus = vim.g.lualine_laststatus - local trouble = require("trouble") - local symbols = trouble.statusline - and trouble.statusline({ - mode = "symbols", - groups = {}, - title = false, - filter = { range = true }, - format = "{kind_icon}{symbol.name:Normal}", - hl_group = "lualine_c_normal", - }) - - return { + local opts = { options = { theme = "auto", globalstatus = true, @@ -162,10 +151,6 @@ return { }, { "filetype", icon_only = true, separator = "", padding = { left = 1, right = 0 } }, { LazyVim.lualine.pretty_path() }, - { - symbols and symbols.get, - cond = symbols and symbols.has, - }, }, lualine_x = { -- stylua: ignore @@ -222,6 +207,26 @@ return { }, extensions = { "neo-tree", "lazy" }, } + + -- do not add trouble symbols if aerial is enabled + if vim.g.trouble_lualine then + local trouble = require("trouble") + local symbols = trouble.statusline + and trouble.statusline({ + mode = "symbols", + groups = {}, + title = false, + filter = { range = true }, + format = "{kind_icon}{symbol.name:Normal}", + hl_group = "lualine_c_normal", + }) + table.insert(opts.sections.lualine_c, { + symbols and symbols.get, + cond = symbols and symbols.has, + }) + end + + return opts end, },