b0o / incline.nvim

🎈 Floating statuslines for Neovim, winbar alternative
MIT License
759 stars 14 forks source link

Unresponsiveness on events #61

Closed cvigilv closed 5 months ago

cvigilv commented 5 months ago

Hi! Wanted to ask you if the following is intended behaviour:

https://github.com/b0o/incline.nvim/assets/30091515/e3018087-38c4-4a54-838f-3150b302d6f0

Whenever I change modes in my editor, incline (generally) won't update my mode signifier even when the editor already detected that event (see mode status at the bottom of my buffer). This is my configuration of incline.nvim:

      --- Setup incline filename statusbar
      ---@return nil
      local setup_incline = function()
        -- Get current colorscheme `Normal` highlight group
        local utils = require("mateo.utils")
        local hsl = require("lush.hsl")
        local fg = utils.get_hl_group_hex("Normal", "foreground")
        local bg = utils.get_hl_group_hex("Normal", "background")

        -- Setup `incline`
        local incline = require("incline")
        incline.setup({
          window = {
            padding = 0,
            placement = {
              horizontal = "center",
              vertical = "bottom",
            },
          },
          render = function(props)
            local bufname = vim.api.nvim_buf_get_name(props.buf)
            local res = bufname ~= "" and vim.fn.fnamemodify(bufname, ":t") or bufname
            if vim.bo[props.buf].modified then res = "* " .. res end
            return {
              "",
              {
                utils.get_mode(),
                " · ",
                res,
                guifg = fg,
                guibg = hsl(bg).darken(10).hex,
                gui = "bold",
              },
              "",
              guifg = hsl(bg).darken(10).hex,
              guibg = "none",
            }
          end,
          hide = { cursorline = true },
        })
        vim.on_key(incline.refresh(), 0)
      end

      -- Launch statusline
      vim.api.nvim_create_autocmd({ "ColorScheme", "VimEnter" }, {
        pattern = { "*" },
        callback = setup_incline,
      })
    end,
cvigilv commented 5 months ago

As you may see, I a vim.on_key(incline.refresh(), 0) to force this behaviour but its not responding as intended but it helps A LOT.

Thanks in advance, awesome plugin!

b0o commented 5 months ago

Hey, thanks for letting me know. Does the latest commit solve this for you?

cvigilv commented 5 months ago

Yes! Thanks for the update!