Skip to content
This repository has been archived by the owner on Nov 13, 2024. It is now read-only.

feat: Allow the user to dynamically set open_win_opts #10

Open
woosaaahh opened this issue Nov 16, 2022 · 3 comments
Open

feat: Allow the user to dynamically set open_win_opts #10

woosaaahh opened this issue Nov 16, 2022 · 3 comments

Comments

@woosaaahh
Copy link

Hi !

Is this possible to let the user define the open_win_opts option from a function ?
It would help the user define custom position/size.

If needed, I did it on my fork here in the feat-open_win_opts_function branch here.

Here is what I use :

local function get_open_win_opts()
	local win_id = vim.api.nvim_get_current_win()
	local win_width = vim.api.nvim_win_get_width(win_id)
	local win_height = vim.api.nvim_win_get_height(win_id)
	local open_win_height = math.floor(win_height * 0.4)
	return {
		relative = "win",
		win = win_id,
		border = { "", "", "", "", "", "", "", "" },
		row = win_height - open_win_height - 1,
		col = 0,
		width = win_width,
		height = open_win_height,
	}
end

neo_minimap.setup_defaults({
	auto_jump = true,
	disable_indentaion = false,
	events = { "BufEnter" },
	hl_group = "LineNr",
	open_win_opts = get_open_win_opts,
	query_index = 1,
	width = 44,
})
@ziontee113
Copy link
Owner

Users already can customize open_win_opts option. Is the current main branch version not work for you?

@woosaaahh
Copy link
Author

The customization of open_win_opts in the current master branch works.

But unless I'm missing something, it doesn't work if I want to set the options relative to the current window which means options have to be re-calculated on each neo-minimap calls.

@ziontee113
Copy link
Owner

Ah I see. So you mean a way to change the windows's dimensions and position after it already opened?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants