feat: add override config option to customize float layout (#132)
* (feat) Added override function for floatwin * (feat) Added in-place floatwin option modification Added in-place modification of floatwin options, and removed example from config.lua.
This commit is contained in:
parent
4a4e0f4013
commit
ac72a8df4a
2 changed files with 10 additions and 4 deletions
|
|
@ -80,6 +80,11 @@ local default_config = {
|
||||||
win_options = {
|
win_options = {
|
||||||
winblend = 10,
|
winblend = 10,
|
||||||
},
|
},
|
||||||
|
-- This is the config that will be passed to nvim_open_win.
|
||||||
|
-- Change values here to customize the layout
|
||||||
|
override = function(conf)
|
||||||
|
return conf
|
||||||
|
end,
|
||||||
},
|
},
|
||||||
-- Configuration for the actions floating preview window
|
-- Configuration for the actions floating preview window
|
||||||
preview = {
|
preview = {
|
||||||
|
|
|
||||||
|
|
@ -271,6 +271,7 @@ M.open_float = function(dir)
|
||||||
border = config.float.border,
|
border = config.float.border,
|
||||||
zindex = 45,
|
zindex = 45,
|
||||||
}
|
}
|
||||||
|
win_opts = config.float.override(win_opts) or win_opts
|
||||||
|
|
||||||
local winid = vim.api.nvim_open_win(bufnr, true, win_opts)
|
local winid = vim.api.nvim_open_win(bufnr, true, win_opts)
|
||||||
vim.w[winid].is_oil_win = true
|
vim.w[winid].is_oil_win = true
|
||||||
|
|
@ -323,10 +324,10 @@ M.open_float = function(dir)
|
||||||
end
|
end
|
||||||
vim.api.nvim_win_set_config(winid, {
|
vim.api.nvim_win_set_config(winid, {
|
||||||
relative = "editor",
|
relative = "editor",
|
||||||
row = row,
|
row = win_opts.row,
|
||||||
col = col,
|
col = win_opts.col,
|
||||||
width = width,
|
width = win_opts.width,
|
||||||
height = height,
|
height = win_opts.height,
|
||||||
title = get_title(),
|
title = get_title(),
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue