indentlines.lua 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. local M = {}
  2. M.config = function()
  3. lvim.builtin.indentlines = {
  4. active = true,
  5. on_config_done = nil,
  6. options = {
  7. enabled = true,
  8. debounce = 200,
  9. viewport_buffer = {
  10. min = 30,
  11. max = 500,
  12. },
  13. indent = {
  14. char = lvim.icons.ui.LineLeft,
  15. tab_char = nil,
  16. highlight = "IblIndent",
  17. smart_indent_cap = true,
  18. priority = 1,
  19. },
  20. whitespace = {
  21. highlight = "IblWhitespace",
  22. remove_blankline_trail = true,
  23. },
  24. exclude = {
  25. buftypes = { "terminal", "nofile", "quickfix", "prompt" },
  26. filetypes = {
  27. "NvimTree",
  28. "Trouble",
  29. "dashboard",
  30. "help",
  31. "lazy",
  32. "neogitstatus",
  33. "startify",
  34. "text",
  35. },
  36. },
  37. scope = {
  38. enabled = true,
  39. char = lvim.icons.ui.LineLeft,
  40. show_start = true,
  41. show_end = true,
  42. show_exact_scope = false,
  43. injected_languages = true,
  44. highlight = "IblScope",
  45. priority = 1024,
  46. include = {
  47. node_type = {},
  48. },
  49. exclude = {
  50. language = {},
  51. node_type = {
  52. ["*"] = {
  53. "source_file",
  54. "program",
  55. },
  56. lua = {
  57. "chunk",
  58. },
  59. python = {
  60. "module",
  61. },
  62. },
  63. },
  64. },
  65. },
  66. }
  67. end
  68. M.setup = function()
  69. local status_ok, indent_blankline = pcall(require, "ibl")
  70. if not status_ok then
  71. return
  72. end
  73. local _, err = pcall(indent_blankline.setup, lvim.builtin.indentlines.options)
  74. if err then
  75. local invalid_key = err:match "'(.*)'"
  76. vim.notify_once(
  77. "`lvim.builtin.indentlines.options."
  78. .. invalid_key
  79. .. "` has been deprecated. Please take a look at `:h ibl.config` to learn about new config and update.",
  80. vim.log.levels.WARN
  81. )
  82. end
  83. if lvim.builtin.indentlines.on_config_done then
  84. lvim.builtin.indentlines.on_config_done()
  85. end
  86. end
  87. return M