Skip to content

feat(window): add support for vim.o.winborder #1957

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

iguanacucumber
Copy link

Description

When using the new vim.o.winborder option to set a border for every floating window, it adds a border to the backdrop. So i forced the border to be border = "none"

Screenshots

with vim.o.border = "rounded"

without the fix:
20250323_14h16m59s_grim

with the fix:
20250323_14h17m17s_grim

@iguanacucumber iguanacucumber changed the title fix: do not create a border for the backdrop with vim.o.winborder fix(backdrop): do not create a border for the backdrop with vim.o.winborder Mar 23, 2025
@iguanacucumber iguanacucumber changed the title fix(backdrop): do not create a border for the backdrop with vim.o.winborder fix(window): add support for vim.o.winborder Mar 23, 2025
@iguanacucumber iguanacucumber changed the title fix(window): add support for vim.o.winborder feat(window): add support for vim.o.winborder Mar 23, 2025
@iguanacucumber
Copy link
Author

iguanacucumber commented Mar 23, 2025

(i created a submodule while testing this and git submodules are cumberson, but now it's good)

@ssiyad
Copy link

ssiyad commented Apr 5, 2025

@folke can you look into this please?

tristan957 added a commit to tristan957/dotfiles that referenced this pull request May 3, 2025
It is not currently in upstream.

Link: mason-org/mason.nvim#1900
Link: folke/lazy.nvim#1957
Signed-off-by: Tristan Partin <[email protected]>
Copy link
Contributor

github-actions bot commented May 6, 2025

This PR is stale because it has been open 30 days with no activity.

@github-actions github-actions bot added the stale label May 6, 2025
@@ -53,7 +53,7 @@ function M:init(opts)
self.opts = vim.tbl_deep_extend("force", {
size = Config.options.ui.size,
style = "minimal",
border = Config.options.ui.border or "none",
border = Config.options.ui.border or vim.o.winborder or "none",
Copy link
Contributor

@seblyng seblyng Jul 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will not work properly with winborder now supporting custom borderchars. See here for example for how it can be supported: Saghen/blink.cmp#1984

It will also probably error for users that are not using nvim 0.11. I think something like this might work:

border = Config.options.ui.border or vim.fn.exists("&winborder") == 0 and "none" or nil,

@@ -66,7 +66,7 @@ function M:init(opts)
self.win_opts = {
relative = "editor",
style = self.opts.style ~= "" and self.opts.style or nil,
border = self.opts.border,
border = self.opts.border or vim.o.winborder,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not needed. The line I posted in the other comment will just have the border be nil, which will default back to winborder without this.

@@ -92,7 +92,7 @@ function M:layout()
self.win_opts.row = math.floor((vim.o.lines - self.win_opts.height) / 2)
self.win_opts.col = math.floor((vim.o.columns - self.win_opts.width) / 2)

if self.opts.border ~= "none" then
if self.opts.border ~= "none" or vim.o.winborder then
self.win_opts.row = self.win_opts.row - 1
self.win_opts.col = self.win_opts.col - 1
end
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something like:

  local border = self.opts.border or vim.fn.exists("&winborder") == 1 and vim.o.winborder or "none"
  if border ~= "none" or border ~= "" then

should work.

winborder defaults to "" which is the same as "none", so we should check that as well

@github-actions github-actions bot removed the stale label Jul 30, 2025
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

Successfully merging this pull request may close these issues.

3 participants