anuvyklack / hydra.nvim

Create custom submodes and menus
1.01k stars 26 forks source link

Lualine Mode not working #48

Open dantearaujo1 opened 1 year ago

dantearaujo1 commented 1 year ago

Im trying to customize my Lualine A section with Hydra's name, but using require('hydra.statusline').get_name with conditioning using require('hydra.statusline').is_active shows nothing .

local hydra = require("hydra.statusline")

require'lualine'.setup {
  options = {
    icons_enabled = true,
    theme = 'auto',
    -- component_separators = {'', ''},
    -- section_separators = {'', ''},
    disabled_filetypes = {
      statusline = {},
      winbar = {},
    },
    ignore_focus = {},
    always_divide_middle = true,
    globalstatus = true,
    refresh ={
      statusline = 1000,
      tabline = 1000,
      winbar = 1000,
    }
  },
  sections = {
    lualine_a = {'mode',{hydra.get_name, cond = hydra.is_active}},
    -- lualine_a = {hydra_status.get_name()},
    lualine_b = {'branch'},
    lualine_c = {'filename', {gps.get_location, cond = gps.is_available}},
    lualine_x = {'filetype', 'fileformat', 'encoding'},
    lualine_y = {'progress'},
    lualine_z = {'location'}
  },
  inactive_sections = {
    lualine_a = {},
    lualine_b = {},
    lualine_c = {'filename'},
    lualine_x = {'location'},
    lualine_y = {},
    lualine_z = {}
  },
  tabline = {},
  extensions = {}
}
anuvyklack commented 1 year ago

Is this problem valid after #49?

dantearaujo1 commented 1 year ago

It's still a problem

This is where i set a test function called hello returning hydra.statusline.get_name() image

Here is the result when i'm HYDRA mode image

This is the hello function for test image

image

bschnitz commented 1 year ago

Do You still have this problem? I'm also using lualine and it is working fine for me. (Tested Your lualine configuration without the gps part.) Does your hydra have a name? If You don't define one, nil is returned by `hydra.get_name()'?

dantearaujo1 commented 1 year ago

nil is returned by `hydra.get_name()'? Yes Do You still have this problem? Yes Tested Your lualine configuration without the gps part. Tried, same result! Yes all my hydras have a name.

ghost commented 1 year ago

Same, status not updated when activate a hydra.

require("hydra.statusline").is_active() always returns false here.

{
                        function()
                            return require("hydra.statusline").is_active()
                            --return hydra.get_name() .. ": " .. hydra.get_hint()
                        end,
                        -- cond = require("hydra.statusline").is_active,
                        color = { fg = "#ffffff", gui = "bold" }
},

2022-12-29_17-09

ghost commented 1 year ago

Same, status not updated when activate a hydra.

require("hydra.statusline").is_active() always returns false here.

{
                        function()
                            return require("hydra.statusline").is_active()
                            --return hydra.get_name() .. ": " .. hydra.get_hint()
                        end,
                        -- cond = require("hydra.statusline").is_active,
                        color = { fg = "#ffffff", gui = "bold" }
},

2022-12-29_17-09

Works with heirline.