treesitter.lua 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. local M = {}
  2. M.config = function()
  3. lvim.builtin.treesitter = {
  4. ensure_installed = {}, -- one of "all", "maintained" (parsers with maintainers), or a list of languages
  5. ignore_install = {},
  6. matchup = {
  7. enable = false, -- mandatory, false will disable the whole extension
  8. -- disable = { "c", "ruby" }, -- optional, list of language that will be disabled
  9. },
  10. highlight = {
  11. enable = true, -- false will disable the whole extension
  12. additional_vim_regex_highlighting = true,
  13. disable = { "latex" },
  14. },
  15. context_commentstring = {
  16. enable = false,
  17. config = { css = "// %s" },
  18. },
  19. -- indent = {enable = true, disable = {"python", "html", "javascript"}},
  20. -- TODO seems to be broken
  21. indent = { enable = { "javascriptreact" } },
  22. autotag = { enable = false },
  23. textobjects = {
  24. swap = {
  25. enable = false,
  26. -- swap_next = textobj_swap_keymaps,
  27. },
  28. -- move = textobj_move_keymaps,
  29. select = {
  30. enable = false,
  31. -- keymaps = textobj_sel_keymaps,
  32. },
  33. },
  34. textsubjects = {
  35. enable = false,
  36. keymaps = { ["."] = "textsubjects-smart", [";"] = "textsubjects-big" },
  37. },
  38. playground = {
  39. enable = false,
  40. disable = {},
  41. updatetime = 25, -- Debounced time for highlighting nodes in the playground from source code
  42. persist_queries = false, -- Whether the query persists across vim sessions
  43. keybindings = {
  44. toggle_query_editor = "o",
  45. toggle_hl_groups = "i",
  46. toggle_injected_languages = "t",
  47. toggle_anonymous_nodes = "a",
  48. toggle_language_display = "I",
  49. focus_language = "f",
  50. unfocus_language = "F",
  51. update = "R",
  52. goto_node = "<cr>",
  53. show_help = "?",
  54. },
  55. },
  56. rainbow = {
  57. enable = false,
  58. extended_mode = true, -- Highlight also non-parentheses delimiters, boolean or table: lang -> boolean
  59. max_file_lines = 1000, -- Do not enable for files with more than 1000 lines, int
  60. },
  61. }
  62. end
  63. M.setup = function()
  64. local status_ok, treesitter_configs = pcall(require, "nvim-treesitter.configs")
  65. if not status_ok then
  66. return
  67. end
  68. treesitter_configs.setup(lvim.builtin.treesitter)
  69. end
  70. return M