davidosomething/dotfiles

nvim - incline.nvim

davidosomething opened this issue · 2 comments

  -- floating statusline
  {
    "b0o/incline.nvim",
    dependencies = {
      "nvim-lua/lsp-status.nvim",
    },
    config = function()
      -- @class RenderProps
      -- @field buf number
      -- @field window number
      -- @param props RenderProps
      local function render(props)
        local res = ""

        -- ===================================================================
        -- LSP status in incline
        -- ===================================================================

        --[[ for sev, num in pairs(require("lsp-status").status()) do

        end ]]
        if #vim.lsp.get_active_clients({ bufnr = props.buf }) > 0 then
          res = res .. require("lsp-status").status()
        end

        return res
      end
      require("incline").setup({
        render = render,
      })
    end,
  },

consider

don't need it

search term

  {
    "b0o/incline.nvim",
    event = "VeryLazy",
    config = function()
      require('incline').setup({
        ---@class InclineRenderProps
        ---@field buf number
        ---@field win number
        ---@field focused boolean

        ---@param props InclineRenderProps
        render = function(props)
          if not props.focused then return "" end

          local count = vim.fn.searchcount({ recompute = 1, maxcount = -1 })
          local contents = vim.fn.getreg("/")
          if string.len(contents) == 0 then return "" end

          return {
            {
              " ? ",
              group = "dkoStatusKey",
            },
            {
              (" %s "):format(contents),
              group = "IncSearch",
            },
            {
              (" %d/%d "):format(count.current, count.total),
              group = "dkoStatusValue",
            }
          }
        end,

        window = {
          margin = { horizontal = 0 },
          padding = 0,
        },
      })
    end,
  },