b0o / incline.nvim

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

Behavior of `hide.cursorline` is incorrect if window contains wrapped lines #18

Closed b0o closed 2 years ago

b0o commented 2 years ago

This is due to nvim_win_get_cursor() returning the cursor position in the buffer, not the window.

idr4n commented 1 year ago

Hi and thanks for a cool plugin!

I have been using it and lately I notice that I would like to hide it when I have some first long lines. Tried the setting to hide cursorline but it does not seem to be working for me, and toggling wrap with :set wrap! does not make it work either. This is my config:

{
    "b0o/incline.nvim",
    event = "BufReadPre",
    config = function()
        local colors = require("tokyonight.colors").setup()
        require("incline").setup({
            highlight = {
                groups = {
                    InclineNormal = { guifg = "#9d7cd8", guibg = colors.black },
                    InclineNormalNC = { guibg = colors.blue7, guifg = colors.fg },
                },
            },
            hide = { cursorline = true, only_win = true },
            window = { margin = { vertical = 0, horizontal = 1 } },
            render = function(props)
                local filename = vim.fn.fnamemodify(vim.api.nvim_buf_get_name(props.buf), ":t")
                local icon, color = require("nvim-web-devicons").get_icon_color(filename)
                return { { icon, guifg = color }, { " " }, { filename } }
            end,
        })
    end,
}

Actually, I just realized that if window.margin.vertical is set like above, then hide.cursorline does not work. If I remove the margin setting, then it does. I do like margin.vertical set to 0 though as it looks better for vertical splits as shown in the repo screenshot.

Thanks in advance.