Fix Status bar

This commit is contained in:
Snoweuph 2024-06-01 21:57:04 +02:00
parent acb1c692bf
commit adb2953f8c
Signed by: Snoweuph
GPG key ID: A494330694B208EF
2 changed files with 72 additions and 1 deletions

View file

@ -5,9 +5,11 @@ return {
"nvim-tree/nvim-web-devicons",
"nvimdev/lspsaga.nvim",
},
after = "rcarriga/nvim-dap-ui",
config = function()
-- Setup --
local lspsaga_breadcrumbs = require("lspsaga.symbol.winbar").get_bar
require("lualine").setup({
options = {
component_separators = { left = "", right = "" },
@ -16,6 +18,15 @@ return {
"neo-tree",
"fugitive",
"help",
statusline = {
"dap-repl",
"dapui_console",
"dapui_console",
"dapui_watches",
"dapui_stacks",
"dapui_breakpoints",
"dapui_scopes",
},
},
ignore_focus = {},
always_divide_middle = true,
@ -49,7 +60,9 @@ return {
inactive_winbar = {
lualine_a = { "filename" },
},
extensions = {},
extensions = {
require("plugins.temp.status_bar_plugin"),
},
})
end,
},

View file

@ -0,0 +1,58 @@
local M = {}
M.filetypes = {
"dap-repl",
"dapui_console",
"dapui_console",
"dapui_watches",
"dapui_stacks",
"dapui_breakpoints",
"dapui_scopes",
}
local function merge_colors(foreground, background)
local new_name = foreground .. background
local hl_fg = vim.api.nvim_get_hl(0, { name = foreground })
local hl_bg = vim.api.nvim_get_hl(0, { name = background })
local fg = string.format("#%06x", hl_fg.fg and hl_fg.fg or 0)
local bg = string.format("#%06x", hl_bg.bg and hl_bg.bg or 0)
vim.api.nvim_set_hl(0, new_name, { fg = fg, bg = bg })
return new_name
end
local function get_dap_repl_winbar(active)
local get_mode = require("lualine.highlight").get_mode_suffix
return function()
local filetype = vim.bo.filetype
local disabled_filetypes = { "dap-repl" }
if not vim.tbl_contains(disabled_filetypes, filetype) then
return ""
end
local background_color = string.format("lualine_b" .. "%s", active and get_mode() or "_inactive")
local controls_string = "%#" .. background_color .. "#"
for element in require("dapui.controls").controls():gmatch("%S+") do
local color, action = string.match(element, "%%#(.*)#(%%.*)%%#0#")
controls_string = controls_string .. " %#" .. merge_colors(color, background_color) .. "#" .. action
end
return controls_string
end
end
M.winbar = {
lualine_a = { { "filename", file_status = false } },
lualine_b = { get_dap_repl_winbar(true) },
}
M.inactive_winbar = {
lualine_a = { { "filename", file_status = false } },
lualine_b = { get_dap_repl_winbar(false) },
}
return M