noice.lua 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. -- 通知中心
  2. return {
  3. "folke/noice.nvim",
  4. event = "VeryLazy",
  5. opts = {
  6. lsp = {
  7. override = {
  8. ["vim.lsp.util.convert_input_to_markdown_lines"] = true,
  9. ["vim.lsp.util.stylize_markdown"] = true,
  10. ["cmp.entry.get_documentation"] = true,
  11. },
  12. },
  13. routes = {
  14. {
  15. filter = {
  16. event = "msg_show",
  17. any = {
  18. { find = "%d+L, %d+B" },
  19. { find = "; after #%d+" },
  20. { find = "; before #%d+" },
  21. },
  22. },
  23. view = "mini",
  24. },
  25. },
  26. presets = {
  27. bottom_search = true,
  28. command_palette = true,
  29. long_message_to_split = true,
  30. inc_rename = true,
  31. },
  32. },
  33. -- stylua: ignore
  34. keys = {
  35. { "<S-Enter>", function() require("noice").redirect(vim.fn.getcmdline()) end, mode = "c", desc = "Redirect Cmdline" },
  36. { "<leader>snl", function() require("noice").cmd("last") end, desc = "Noice Last Message" },
  37. { "<leader>snh", function() require("noice").cmd("history") end, desc = "Noice History" },
  38. { "<leader>sna", function() require("noice").cmd("all") end, desc = "Noice All" },
  39. { "<leader>snd", function() require("noice").cmd("dismiss") end, desc = "Dismiss All" },
  40. { "<c-f>", function() if not require("noice.lsp").scroll(4) then return "<c-f>" end end, silent = true, expr = true, desc = "Scroll forward", mode = { "i", "n", "s" } },
  41. { "<c-b>", function() if not require("noice.lsp").scroll(-4) then return "<c-b>" end end, silent = true, expr = true, desc = "Scroll backward", mode = { "i", "n", "s" } },
  42. },
  43. }