fix: Preview window position based on outline split position
- preview window can adapt based on position of outline window, and not based on config value of `position` left/right - it can also properly vertically center-align, even when there are horizontal splits below the outline - fixed a few bugs associated with previous rewrite commits in init.lua config: - Added min_height for preview window
This commit is contained in:
@@ -6,15 +6,17 @@ function View:new()
|
||||
return setmetatable({ bufnr = nil, winnr = nil }, { __index = View })
|
||||
end
|
||||
|
||||
---creates the outline window and sets it up
|
||||
function View:setup_view()
|
||||
---Creates the outline window and sets it up
|
||||
---@param split_command string A valid split command that is to be executed in order to create the view.
|
||||
function View:setup_view(split_command)
|
||||
-- create a scratch unlisted buffer
|
||||
self.bufnr = vim.api.nvim_create_buf(false, true)
|
||||
|
||||
-- delete buffer when window is closed / buffer is hidden
|
||||
vim.api.nvim_buf_set_option(self.bufnr, 'bufhidden', 'delete')
|
||||
-- create a split
|
||||
vim.cmd(cfg.get_split_command())
|
||||
vim.cmd(split_command)
|
||||
|
||||
-- resize to a % of the current window size
|
||||
vim.cmd('vertical resize ' .. cfg.get_window_width())
|
||||
|
||||
|
||||
Reference in New Issue
Block a user