indentlines.lua 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. vim.notify_once(
  76. err .. ". Please take a look at `:h ibl.config` to learn about config and update.",
  77. vim.log.levels.WARN
  78. )
  79. end
  80. if lvim.builtin.indentlines.on_config_done then
  81. lvim.builtin.indentlines.on_config_done()
  82. end
  83. end
  84. return M