summaryrefslogtreecommitdiff
path: root/lua/talha/plugins/treesitter.lua
diff options
context:
space:
mode:
authortalha <talha@talhaamir.xyz>2026-07-26 11:55:58 +0500
committertalha <talha@talhaamir.xyz>2026-07-26 11:55:58 +0500
commit1c8503345693788660ac0a132b111ebeb08ed87f (patch)
treef78456b136fef6ad77885ee518e3def2dcde1a6f /lua/talha/plugins/treesitter.lua
parent70fe2441aa025243e29d47aabe1b6674c4e0ed71 (diff)
Updated config
Diffstat (limited to 'lua/talha/plugins/treesitter.lua')
-rw-r--r--lua/talha/plugins/treesitter.lua30
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
}