Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow dynamic repositioning based on current line #79

Open
cohml opened this issue Dec 20, 2024 · 0 comments
Open

Allow dynamic repositioning based on current line #79

cohml opened this issue Dec 20, 2024 · 0 comments

Comments

@cohml
Copy link

cohml commented Dec 20, 2024

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.

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
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant