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

114 lines
2.5 KiB
Lua
Raw Normal View History

2024-11-30 17:40:46 -08:00
return {
'noice.nvim',
event = 'DeferredUIEnter',
keys = {
2024-12-01 17:10:02 -08:00
{ '<LEADER>n', '', desc = '+notifications' },
2024-11-30 17:40:46 -08:00
{
'<S-ENTER>',
function()
require('noice').redirect(vim.fn.getcmdline())
end,
mode = 'c',
2024-12-01 17:10:02 -08:00
desc = 'redirect cmdline',
2024-11-30 17:40:46 -08:00
},
{
'<LEADER>nl',
function()
require('noice').cmd('last')
end,
2024-12-01 17:10:02 -08:00
desc = 'last message',
2024-11-30 17:40:46 -08:00
},
{
'<LEADER>nh',
function()
require('noice').cmd('history')
end,
2024-12-01 17:10:02 -08:00
desc = 'message history',
2024-11-30 17:40:46 -08:00
},
{
'<LEADER>na',
function()
require('noice').cmd('all')
end,
2024-12-01 17:10:02 -08:00
desc = 'all messages',
2024-11-30 17:40:46 -08:00
},
{
'<LEADER>nd',
function()
require('noice').cmd('dismiss')
end,
2024-12-01 17:10:02 -08:00
desc = 'dismiss all',
2024-11-30 17:40:46 -08:00
},
{
'<LEADER>nt',
function()
require('noice').cmd('pick')
end,
2024-12-01 17:10:02 -08:00
desc = 'message picker',
2024-11-30 17:40:46 -08:00
},
{
'<C-f>',
function()
if not require('noice.lsp').scroll(4) then
return '<C-f>'
end
end,
mode = { 'i', 'n', 's' },
silent = true,
expr = true,
2024-12-01 17:10:02 -08:00
desc = 'scroll forward',
2024-11-30 17:40:46 -08:00
},
{
'<C-b>',
function()
if not require('noice.lsp').scroll(-4) then
return '<C-b>'
end
end,
mode = { 'i', 'n', 's' },
silent = true,
expr = true,
2024-12-01 17:10:02 -08:00
desc = 'scroll backward',
2024-11-30 17:40:46 -08:00
},
},
before = function()
2024-12-01 17:10:02 -08:00
require('lz.n').trigger_load({ 'nui.nvim', 'which-key.nvim' })
2024-11-30 17:40:46 -08:00
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,
},
})
2024-12-01 17:10:02 -08:00
local mkKey = MarleyVim.wkSpec(require('colors').notifications)
require('which-key').add({
2024-12-04 21:41:30 -08:00
mkKey('<S-ENTER>', nil, '', { mode = 'c' }),
mkKey('<C-f>', nil, '', { mode = { 'i', 'n', 's' } }),
mkKey('<C-b>', nil, '', { mode = { 'i', 'n', 's' } }),
2024-12-01 17:10:02 -08:00
})
2024-11-30 17:40:46 -08:00
end,
}