diff options
| author | talha <talha@talhaamir.xyz> | 2026-07-26 11:55:58 +0500 |
|---|---|---|
| committer | talha <talha@talhaamir.xyz> | 2026-07-26 11:55:58 +0500 |
| commit | 1c8503345693788660ac0a132b111ebeb08ed87f (patch) | |
| tree | f78456b136fef6ad77885ee518e3def2dcde1a6f /lua/talha/plugins/treesitter.lua | |
| parent | 70fe2441aa025243e29d47aabe1b6674c4e0ed71 (diff) | |
Updated config
Diffstat (limited to 'lua/talha/plugins/treesitter.lua')
| -rw-r--r-- | lua/talha/plugins/treesitter.lua | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/lua/talha/plugins/treesitter.lua b/lua/talha/plugins/treesitter.lua index 53d3ca0..7cf6c38 100644 --- a/lua/talha/plugins/treesitter.lua +++ b/lua/talha/plugins/treesitter.lua @@ -1,22 +1,28 @@ return { { "nvim-treesitter/nvim-treesitter", + branch = "main", lazy = false, build = ":TSUpdate", config = function () - local configs = require("nvim-treesitter.configs") + local ts = require("nvim-treesitter") - configs.setup({ - ensure_installed = { - "c", "cpp", "python", - "vim", "vimdoc", "query", - }, - sync_install = false, - highlight = { - enable = true, - additional_vim_regex_highlighting = false, - }, - indent = { enable = true }, + -- Automatically install your specified parsers + ts.install({ + "c", "cpp", "python", + "vim", "vimdoc", "query" + }) + + -- Enable highlighting and indentation using Neovim's built-in APIs + vim.api.nvim_create_autocmd("FileType", { + pattern = { "*.yml", "*.sql", "Dockerfile*", "CMakeLists*", "*.py", "*.c", "*.cpp", "*.h", "*.hpp" }, + callback = function() + -- Replaces highlight = { enable = true } + vim.treesitter.start() + + -- Replaces indent = { enable = true } + vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()" + end, }) end } |
