echasnovski / mini.nvim

Library of 40+ independent Lua modules improving overall Neovim (version 0.8 and higher) experience with minimal effort
MIT License
4.45k stars 171 forks source link

How to change mini.notify to bottom right corner #942

Closed saifulapm closed 1 month ago

saifulapm commented 1 month ago

Contributing guidelines

Module(s)

mini.notify

Description

Hi, First thanks for your great works.

I am trying to move notify window bottom right corner. But not sure how I can do it.

Neovim version

10.0.0

Steps to reproduce


require('mini.notify').setup({
    window = {
      config = {
        border = 'solid',
        anchor = 'SE',
      },
    },
  })

Expected behavior

No response

Actual behavior

It always render top right side. But I want to render on bottom right size. Is it doable ?

echasnovski commented 1 month ago

It is indeed possible with config.window.config, but needs to account for some default values used in it.

You were close: single anchor is not enough as it configures which corner of floating window itself should be put at row and col of window config. The following setup should work:

local win_config = function()
  local row = vim.o.lines - vim.o.cmdheight - (vim.o.laststatus >= 2 and 1 or 0)
  return { border = 'solid', anchor = 'SE', row = row }
end
require('mini.notify').setup({ window = { config = win_config } })

Making config callable allows for a more dynamic adjustment of row (like after resizing the whole instance window, changing command height, etc.).