| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- return {
- {
- "nvim-treesitter/nvim-treesitter",
- enabled = true,
- lazy = false,
- config = function(_, _)
- local api = require("nvim-treesitter.configs")
- api.setup({
- ensure_installed = "all",
- sync_install = false,
- auto_install = true,
- highlight = {
- enable = true,
- additional_vim_regex_highlighting = false
- }
- })
- vim.opt.foldmethod = "expr"
- vim.opt.foldexpr = "nvim_treesitter#foldexpr()"
- vim.api.nvim_create_autocmd("LspAttach", {
- callback = function(args)
- local client = vim.lsp.get_client_by_id(args.data.client_id)
- if vim.treesitter ~= nil and client ~= nil and
- type(vim.treesitter.highlighter.active[args.buf]) ~= "nil" then
- client.server_capabilities.semanticTokensProvider = nil
- end
- end
- })
- end,
- build = function()
- require("nvim-treesitter.install").update({ with_sync = true })
- end
- }, {
- "nvim-treesitter/nvim-treesitter-context",
- enabled = true,
- lazy = false,
- dependencies = { "nvim-treesitter/nvim-treesitter" },
- config = function(_, _)
- require("treesitter-context").setup({
- enable = true,
- max_lines = 5,
- min_window_height = 0,
- line_numbers = true,
- multiline_threshold = 20,
- trim_scope = "outer",
- mode = "cursor",
- zindex = 20,
- on_attach = nil
- })
- vim.api.nvim_set_hl(0, "TreesitterContextSeparator",
- { link = "WinSeparator" })
- vim.keymap.set("n", "sc", function()
- require("treesitter-context").go_to_context(vim.v.count1)
- end, { silent = true })
- end
- }
- }
|