-
Notifications
You must be signed in to change notification settings - Fork 76
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
How can I position the float window on the top right with some padding? #107
Comments
Yes, this should be doable with the override function. Try something like require('aerial').setup({
float = {
relative = "editor",
override = function(conf)
local padding = 4
conf.anchor = 'NE'
conf.row = padding
conf.col = vim.o.columns - padding
return conf
end,
}
}) |
Thank you. It is working well though not with more than one splits as it is not positioned within the buffer window. But not a big issue, I have a toggle mapping to use it when I need it 馃檪 |
If you want it contained within the current window use |
I did try that but it doesn't work. It still displayes at the top right of the editor. Another approach could be to have the float at a fixed position but refreshing depending on the active buffer. |
Oh sorry, you'll also have to change the layout column. Instead of |
In general, I'd recommend checking out the documentation for |
It works great: For reference: float = {
relative = "win",
override = function(conf)
local padding = 1
conf.anchor = 'NE'
conf.row = padding
conf.col = vim.api.nvim_win_get_width(0) - padding
return conf
end,
}, and the autocommand: vim.api.nvim_exec(
[[
au! WinLeave *.rs AerialCloseAll
]], false) I needed the autocommand because as you can see in the gif my splits resize automatically and that was messing up the placement. In any case I think this is quite elegant 馃檪 Thank you for the help! |
This broke with the last update. I see there is a deprecation TODO related to it in the source code but could I have some help with converting it? 馃槵 |
I think this wasn't related to deprecation of anything, but instead was because of a change to when the override function gets called. I've made a tweak to that, but also I've changed the signature to pass in the source window ID. I'd recommend making the following change to your config: float = {
relative = "win",
override = function(conf, source_winid) -- <- the source_winid is new
local padding = 1
conf.anchor = 'NE'
conf.row = padding
conf.col = vim.api.nvim_win_get_width(source_winid) - padding
return conf
end,
}, The reason is using |
My mistake, I hadn't updated. Seems to be ok now 馃憤 Thank you for your help 馃檪 |
Thank you for making this, it is very useful 馃檪
At the moment the floating window options seem to assume that we would like it placed at the center of the editor, window or at the cursor position. Shouldn't there be an option to position it anywhere? I would like to position it at the top right of the window with some padding. Is there maybe a way to achieve this effect with the override function?
The text was updated successfully, but these errors were encountered: