Change opacity of noice popupmenu with cmp backend
To avoid strange rendering of popupmenu with background code,
it is better to make the popupmenu untransparent.
Inside ~/.config/nvim/lua/config/lazy.lua, add the following code:
1
vim.cmd("hi Pmenu blend=0")
Change position of noice message
Noice message is displayed at the right upper corner of the window by default.
If you are using a traditional cmdline at the bottom, it will be distracting
to type command then check the message at the top.
Currently, there are old solutions for noice using nvim-notify backend,
such as follows:
1
2
3
require("nofity").setup({top_down=false,})
However, it only places the message at right bottom corner, and Lazyvim
at the time of writing this post has switched to the snacks.nvim backend.
In ~/.config/nvim/lua/plugins/ui.lua, add snack notifier options:
1
2
3
4
5
6
7
8
9
10
11
12
13
return{-- Other configurations{"folke/snacks.nvim",opts={-- Add opts for snack.notifiernotifier={top_down=false,margin={top=1,right=2^63-1,bottom=0},},},},}
This will place the message at the left bottom corner of the window.
To check if your noice message is using snacks.notifier backend,
check in ../noice.nvim/lua/noice/config/views.lua, and see if the following
---@class snacks.notifier.Config---@field enabled? boolean---@field keep? fun(notif: snacks.notifier.Notif): boolean # global keep functionlocaldefaults={timeout=3000,-- default timeout in mswidth={min=40,max=0.4},height={min=1,max=0.6},-- editor margin to keep free. tabline and statusline are taken into account automaticallymargin={top=0,right=1,bottom=0},padding=true,-- add 1 cell of left/right padding to the notification windowsort={"level","added"},-- sort by level and time-- minimum log level to display. TRACE is the lowest-- all notifications are stored in historylevel=vim.log.levels.TRACE,icons={error=" ",warn=" ",info=" ",debug=" ",trace=" ",},keep=function(notif)returnvim.fn.getcmdpos()>0end,---@type snacks.notifier.stylestyle="compact",top_down=true,-- place notifications from top to bottomdate_format="%R",-- time format for notifications-- format for footer when more lines are available-- `%d` is replaced with the number of lines.-- only works for styles with a border---@type string|booleanmore_format=" ↓ %d lines ",refresh=50,-- refresh at most every 50ms}
And the logic used for the message window position:
1
2
3
4
5
6
functionN:layout()--- other partsnotif.win.opts.row=notif.layout.top-1notif.win.opts.col=vim.o.columns-notif.layout.width-self.opts.margin.right--- other partsend