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

feat: Add winblend option #51

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ navbuddy.setup {
size = "60%", -- Or table format example: { height = "40%", width = "100%"}
position = "50%", -- Or table format example: { row = "100%", col = "0%"}
scrolloff = nil, -- scrolloff value within navbuddy window
winblend = nil, -- winblend value [0-100 or nil] (transparency)
sections = {
left = {
size = "20%",
Expand Down
1 change: 1 addition & 0 deletions doc/navbuddy.txt
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ Defaults >
size = "60%", -- Or table format example: { height = "40%", width = "100%"}
position = "50%", -- Or table format example: { row = "100%", col = "0%"}
scrolloff = nil, -- scrolloff value within navbuddy window
winblend = nil, -- winblend value [0-100 or nil] (transparency)
sections = {
left = {
size = "20%",
Expand Down
35 changes: 24 additions & 11 deletions lua/nvim-navbuddy/display.lua
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,25 @@ function display:new(obj)
self.__index = self

local config = obj.config
obj.winblend = config.window.winblend

local win_options = {}
if obj.winblend ~= nil then
win_options = {
winblend = obj.winblend,
}
else
win_options = {
winhighlight = "Normal:NavbuddyNormalFloat,FloatBorder:NavbuddyFloatBorder",
Copy link
Owner

Choose a reason for hiding this comment

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

Are winblend and winhiglight options exclusive of each other? 🤔

}
end


-- NUI elements
local left_popup = nui_popup({
focusable = false,
border = config.window.sections.left.border or ui.get_border_chars(config.window.border, "left"),
win_options = {
winhighlight = "Normal:NavbuddyNormalFloat,FloatBorder:NavbuddyFloatBorder",
},
win_options = win_options,
buf_options = {
modifiable = false,
},
Expand All @@ -102,10 +113,7 @@ function display:new(obj)
local mid_popup = nui_popup({
enter = true,
border = config.window.sections.mid.border or ui.get_border_chars(config.window.border, "mid"),
win_options = {
winhighlight = "Normal:NavbuddyNormalFloat,FloatBorder:NavbuddyFloatBorder",
scrolloff = config.window.scrolloff
},
win_options = win_options,
buf_options = {
modifiable = false,
},
Expand Down Expand Up @@ -133,10 +141,9 @@ function display:new(obj)
style = config.window.sections.right.border or ui.get_border_chars(config.window.border, "right"),
text = lsp_name,
},
win_options = {
winhighlight = "Normal:NavbuddyNormalFloat,FloatBorder:NavbuddyFloatBorder",
win_options = vim.tbl_deep_extend("force", {
scrolloff = 0,
},
}, win_options),
buf_options = {
modifiable = false,
},
Expand Down Expand Up @@ -333,11 +340,17 @@ end
function display:show_preview()
vim.api.nvim_win_set_buf(self.right.winid, self.for_buf)

vim.api.nvim_win_set_option(self.right.winid, 'winhighlight', 'Normal:NavbuddyNormalFloat,FloatBorder:NavbuddyFloatBorder')
vim.api.nvim_win_set_option(self.right.winid, "signcolumn", "no")
vim.api.nvim_win_set_option(self.right.winid, "foldlevel", 100)
vim.api.nvim_win_set_option(self.right.winid, "wrap", false)

if self.winblend then
vim.api.nvim_win_set_option(self.right.winid, "winblend", self.winblend)
else
vim.api.nvim_win_set_option(self.right.winid, 'winhighlight',
'Normal:NavbuddyNormalFloat,FloatBorder:NavbuddyFloatBorder')
end

self:reorient(self.right.winid, "smart")
end

Expand Down
1 change: 1 addition & 0 deletions lua/nvim-navbuddy/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ local config = {
size = "60%",
position = "50%",
scrolloff = nil,
winblend = nil,
sections = {
left = {
size = "20%",
Expand Down