treesitter.lua 771 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. -- Use Treesitter for syntax highlighting
  2. require('nvim-treesitter.configs').setup({
  3. highlight = {
  4. enable = true,
  5. },
  6. indent = {
  7. enable = true,
  8. },
  9. incremental_selection = {
  10. enable = true,
  11. keymaps = {
  12. init_selection = ']t',
  13. node_incremental = ']t',
  14. node_decremental = '[t',
  15. },
  16. },
  17. textobjects = {
  18. swap = {
  19. enable = true,
  20. swap_next = {
  21. ['>,'] = '@parameter.inner',
  22. },
  23. swap_previous = {
  24. ['<,'] = '@parameter.inner',
  25. },
  26. },
  27. },
  28. })
  29. -- set foldexpr to use treesitter
  30. vim.o.foldmethod = 'expr'
  31. vim.o.foldexpr = 'nvim_treesitter#foldexpr()'
  32. vim.o.foldenable = false
  33. -- Treesitter context
  34. require('treesitter-context').setup({
  35. enable = true,
  36. multiline_threshold = 5,
  37. })