illuminate.lua 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. local M = {}
  2. M.config = function()
  3. lvim.builtin.illuminate = {
  4. active = true,
  5. on_config_done = nil,
  6. options = {
  7. -- providers: provider used to get references in the buffer, ordered by priority
  8. providers = {
  9. "lsp",
  10. "treesitter",
  11. "regex",
  12. },
  13. -- delay: delay in milliseconds
  14. delay = 120,
  15. -- filetype_overrides: filetype specific overrides.
  16. -- The keys are strings to represent the filetype while the values are tables that
  17. -- supports the same keys passed to .configure except for filetypes_denylist and filetypes_allowlist
  18. filetype_overrides = {},
  19. -- filetypes_denylist: filetypes to not illuminate, this overrides filetypes_allowlist
  20. filetypes_denylist = {
  21. "dirvish",
  22. "fugitive",
  23. "alpha",
  24. "NvimTree",
  25. "lazy",
  26. "neogitstatus",
  27. "Trouble",
  28. "lir",
  29. "Outline",
  30. "spectre_panel",
  31. "toggleterm",
  32. "DressingSelect",
  33. "TelescopePrompt",
  34. "dropbar_menu",
  35. },
  36. -- filetypes_allowlist: filetypes to illuminate, this is overridden by filetypes_denylist
  37. filetypes_allowlist = {},
  38. -- modes_denylist: modes to not illuminate, this overrides modes_allowlist
  39. modes_denylist = {},
  40. -- modes_allowlist: modes to illuminate, this is overridden by modes_denylist
  41. modes_allowlist = {},
  42. -- providers_regex_syntax_denylist: syntax to not illuminate, this overrides providers_regex_syntax_allowlist
  43. -- Only applies to the 'regex' provider
  44. -- Use :echom synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name')
  45. providers_regex_syntax_denylist = {},
  46. -- providers_regex_syntax_allowlist: syntax to illuminate, this is overridden by providers_regex_syntax_denylist
  47. -- Only applies to the 'regex' provider
  48. -- Use :echom synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name')
  49. providers_regex_syntax_allowlist = {},
  50. -- under_cursor: whether or not to illuminate under the cursor
  51. under_cursor = true,
  52. },
  53. }
  54. end
  55. M.setup = function()
  56. local status_ok, illuminate = pcall(require, "illuminate")
  57. if not status_ok then
  58. return
  59. end
  60. local config_ok, _ = pcall(illuminate.configure, lvim.builtin.illuminate.options)
  61. if not config_ok then
  62. return
  63. end
  64. if lvim.builtin.illuminate.on_config_done then
  65. lvim.builtin.illuminate.on_config_done()
  66. end
  67. end
  68. return M