marleyvim/nvim/lua/plugins/ui/noice-nvim.lua

113 lines
2.5 KiB
Lua

return {
'noice.nvim',
event = 'DeferredUIEnter',
keys = {
{ '<LEADER>n', '', desc = '+notifications' },
{
'<S-ENTER>',
function()
require('noice').redirect(vim.fn.getcmdline())
end,
mode = 'c',
desc = 'redirect cmdline',
},
{
'<LEADER>nl',
function()
require('noice').cmd('last')
end,
desc = 'last message',
},
{
'<LEADER>nh',
function()
require('noice').cmd('history')
end,
desc = 'message history',
},
{
'<LEADER>na',
function()
require('noice').cmd('all')
end,
desc = 'all messages',
},
{
'<LEADER>nd',
function()
require('noice').cmd('dismiss')
end,
desc = 'dismiss all',
},
{
'<LEADER>nt',
function()
require('noice').cmd('pick')
end,
desc = 'message picker',
},
{
'<C-f>',
function()
if not require('noice.lsp').scroll(4) then
return '<C-f>'
end
end,
mode = { 'i', 'n', 's' },
silent = true,
expr = true,
desc = 'scroll forward',
},
{
'<C-b>',
function()
if not require('noice.lsp').scroll(-4) then
return '<C-b>'
end
end,
mode = { 'i', 'n', 's' },
silent = true,
expr = true,
desc = 'scroll backward',
},
},
before = function()
require('lz.n').trigger_load({ 'nui.nvim', 'which-key.nvim' })
end,
after = function()
require('noice').setup({
lsp = {
override = {
['vim.lsp.util.convert_input_to_markdown_lines'] = true,
['vim.lsp.util.stylize_markdown'] = true,
['cmp.entry.get_documentation'] = true,
},
},
routes = {
{
filter = {
event = 'msg_show',
any = {
{ find = '%d+L, %d+B' },
{ find = '; after #%d+' },
{ find = '; before #%d+' },
},
},
view = 'mini',
},
},
presets = {
command_palette = true,
long_message_to_split = true,
lsp_doc_border = true,
},
})
local mkKey = MarleyVim.wkSpec(require('colors').notifications)
require('which-key').add({
mkKey('<S-ENTER>', nil, '', { mode = 'c' }),
mkKey('<C-f>', nil, '', { mode = { 'i', 'n', 's' } }),
mkKey('<C-b>', nil, '', { mode = { 'i', 'n', 's' } }),
})
end,
}