nvim-lualine / lualine.nvim

A blazing fast and easy to configure neovim statusline plugin written in pure lua.
MIT License
5.71k stars 455 forks source link

Question how to not override DAP UI control buttons? #1230

Open sytranvn opened 2 months ago

sytranvn commented 2 months ago

I have this lualine config to display file path

    {
      options = {
        icons_enabled = true,
        theme = 'tokyonight',
        component_separators = '|',
        section_separators = '',
      },
      sections = {
        lualine_y = {
          'progress',
          'location'
        },
      },
      winbar = {
        lualine_x = { { 'filename', path = 1 } },
      },
      inactive_winbar = {
        lualine_x = { { 'filename', path = 1 } },
      }
    }

When I debug, the DAP UI buttons are overridden. When I switch window, I can see it flashes then disappears.

https://github.com/nvim-lualine/lualine.nvim/assets/13009812/8d150c82-7392-4c48-9137-7dffec8f1ae8

snoweuph commented 1 month ago

I got some cod working, that gets them back, but only as text, and not as actuall buttons:

local function get_current_winbar()
    local winbar = vim.api.nvim_eval_statusline(vim.opt.winbar:get(), { use_winbar = true }).str
    winbar = winbar:gsub("^%s+", "")
    winbar = winbar:gsub("+$", "") -- My Lualine Separator
    winbar = winbar:gsub("%s+$", "")
    return winbar
end

local dapui = {}
dapui.sections = {
    lualine_a = {},
}
dapui.filetypes = {
    "dap-repl",
    "dapui_console",
    "dapui_console",
    "dapui_watches",
    "dapui_stacks",
    "dapui_breakpoints",
    "dapui_scopes",
}
dapui.winbar = {
    lualine_a = {
        {
            function()
                local filetype = vim.bo.filetype
                local disabled_filetypes = { "dap-repl" }
                if vim.tbl_contains(disabled_filetypes, filetype) then
                    return get_current_winbar()
                else
                    return vim.fn.expand("%:t")
                end
            end,
        },
    },
}

image

snoweuph commented 1 month ago

Well, you could allways completely disable lualine fo the repl, by just putting "dap-repl", in the options.disabled_filetypes

but that would not only disable it for the winbar, but also for the line

image

snoweuph commented 1 month ago

I got it working, PR for extension will come soon: image image image

sytranvn commented 3 weeks ago

@snoweuph Thank you, I'm currently using your code as custom extension and it works great! Hope the PR will be merged soon.

abhinavnatarajan commented 3 weeks ago

Well, you could allways completely disable lualine fo the repl, by just putting "dap-repl", in the options.disabled_filetypes

but that would not only disable it for the winbar, but also for the line

image

disabled_filetypes has a winbar field so that you can just disable the winbar and not the statusline. This is what I am using in my current config.

snoweuph commented 3 weeks ago

Well, you could allways completely disable lualine fo the repl, by just putting "dap-repl", in the options.disabled_filetypes but that would not only disable it for the winbar, but also for the line image

disabled_filetypes has a winbar field so that you can just disable the winbar and not the statusline. This is what I am using in my current config.

but then you lose the unified styling, with the custom extension, for which I opend up a PR, it will be unified