illuminate.lua 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. "packer",
  26. "neogitstatus",
  27. "Trouble",
  28. "lir",
  29. "Outline",
  30. "spectre_panel",
  31. "toggleterm",
  32. "DressingSelect",
  33. "TelescopePrompt",
  34. },
  35. -- filetypes_allowlist: filetypes to illuminate, this is overridden by filetypes_denylist
  36. filetypes_allowlist = {},
  37. -- modes_denylist: modes to not illuminate, this overrides modes_allowlist
  38. modes_denylist = {},
  39. -- modes_allowlist: modes to illuminate, this is overridden by modes_denylist
  40. modes_allowlist = {},
  41. -- providers_regex_syntax_denylist: syntax to not illuminate, this overrides providers_regex_syntax_allowlist
  42. -- Only applies to the 'regex' provider
  43. -- Use :echom synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name')
  44. providers_regex_syntax_denylist = {},
  45. -- providers_regex_syntax_allowlist: syntax to illuminate, this is overridden by providers_regex_syntax_denylist
  46. -- Only applies to the 'regex' provider
  47. -- Use :echom synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name')
  48. providers_regex_syntax_allowlist = {},
  49. -- under_cursor: whether or not to illuminate under the cursor
  50. under_cursor = true,
  51. },
  52. }
  53. end
  54. M.setup = function()
  55. local status_ok, illuminate = pcall(reload, "illuminate")
  56. if not status_ok then
  57. return
  58. end
  59. local config_ok, _ = pcall(illuminate.configure, lvim.builtin.illuminate.options)
  60. if not config_ok then
  61. return
  62. end
  63. if lvim.builtin.illuminate.on_config_done then
  64. lvim.builtin.illuminate.on_config_done()
  65. end
  66. end
  67. return M