-
Notifications
You must be signed in to change notification settings - Fork 462
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
base: main
Are you sure you want to change the base?
Conversation
(i created a submodule while testing this and git submodules are cumberson, but now it's good) |
@folke can you look into this please? |
It is not currently in upstream. Link: mason-org/mason.nvim#1900 Link: folke/lazy.nvim#1957 Signed-off-by: Tristan Partin <[email protected]>
This PR is stale because it has been open 30 days with no activity. |
@@ -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", |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
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 beborder = "none"
Screenshots
with
vim.o.border = "rounded"
without the fix:

with the fix:
