incline.nvim icon indicating copy to clipboard operation
incline.nvim copied to clipboard

Allow dynamic repositioning based on current line

Open cohml opened this issue 1 year ago • 0 comments

I have my floating status line set to the top right corner of my window. But when my cursor is on line 1, the status line can overlap with code.

Image

Currently, options like window.placement.vertical or window.margin.vertical only take static arguments (e.g., int, str), limiting the ability to update the position dynamically.

So it would be really nice if these options also took functions as values. This way, something like the following might work (to shift the status line down a line if my cursor is on line 1):

margin = {
    vertical = function()
        local current_line, _ = unpack(vim.api.nvim_win_get_cursor(0))
        if current_line == 1 then
            return 2
        else
            return 1
        end
    end
}

cohml avatar Dec 20 '24 22:12 cohml