diff --git a/lazy-lock.json b/lazy-lock.json index b062f73..c1cee33 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -35,7 +35,7 @@ "nvim-notify": { "branch": "master", "commit": "bdd647f61a05c9b8a57c83b78341a0690e9c29d7" }, "nvim-scrollview": { "branch": "main", "commit": "ba6c48bf7919dd48a371e7b9c683b8858053e885" }, "nvim-tree.lua": { "branch": "master", "commit": "7eb33d2a6d5d574a43159da90e0eac2445367393" }, - "nvim-treesitter": { "branch": "master", "commit": "8e763332b7bf7b3a426fd8707b7f5aa85823a5ac" }, + "nvim-treesitter": { "branch": "master", "commit": "69388e84c34d40c3d5c7d2f310db13276f2179e1" }, "nvim-ts-autotag": { "branch": "main", "commit": "fdefe46c6807441460f11f11a167a2baf8e4534b" }, "nvim-ts-rainbow": { "branch": "master", "commit": "ef95c15a935f97c65a80e48e12fe72d49aacf9b9" }, "nvim-web-devicons": { "branch": "master", "commit": "2b96193abe4372e18e4f4533895a42a466d53c17" }, diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 09a825c..dc80f71 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -69,12 +69,36 @@ return { -- include treesitter -- require("plugins.treesitter"), + -- { + -- "nvim-treesitter/nvim-treesitter", + -- commit = "8e763332b7bf7b3a426fd8707b7f5aa85823a5ac", + -- run = ":TSUpdate", + -- event = "BufWinEnter", + -- opts = function() + -- require("user.treesitter") + -- end, + -- }, { "nvim-treesitter/nvim-treesitter", - commit = "8e763332b7bf7b3a426fd8707b7f5aa85823a5ac", - run = ":TSUpdate", - event = "BufWinEnter", - opts = function() + cmd = { + "TSBufDisable", + "TSBufEnable", + "TSBufToggle", + "TSDisable", + "TSEnable", + "TSToggle", + "TSInstall", + "TSInstallInfo", + "TSInstallSync", + "TSModuleInfo", + "TSUninstall", + "TSUpdate", + "TSUpdateSync", + }, + build = function() + require("nvim-treesitter.install").update({ with_sync = true })() + end, + config = function() require("user.treesitter") end, }, diff --git a/lua/user/treesitter.lua b/lua/user/treesitter.lua index b2d3a98..569eb99 100644 --- a/lua/user/treesitter.lua +++ b/lua/user/treesitter.lua @@ -1,56 +1,22 @@ -local status_ok, configs = pcall(require, "nvim-treesitter.configs") -if not status_ok then - return -end - -configs.setup({ - ensure_installed = { - -- "bash", - -- "html", - -- "c", - -- "javascript", - "json", - "lua", - -- "python", - -- "typescript", - -- "tsx", - -- "css", - -- "rust", - -- "java", - -- "yaml", - -- "markdown", - -- "markdown_inline", - }, -- one of "all" or a list of languages - ignore_install = { "phpdoc" }, -- List of parsers to ignore installing +require("nvim-treesitter.configs").setup({ highlight = { - enable = true, -- false will disable the whole extension - disable = { "css" }, -- list of language that will be disabled + enable = true, additional_vim_regex_highlighting = false, }, - autopairs = { - enable = true, - }, - indent = { enable = true, disable = { "python", "css" } }, context_commentstring = { enable = true, enable_autocmd = false, - config = { - -- Languages that have a single comment style - typescript = "// %s", - css = "/* %s */", - scss = "/* %s */", - html = "", - svelte = "", - vue = "", - json = "", - }, }, - autotag = { enable = true }, - incremental_selection = { enable = true }, rainbow = { enable = true, disable = { "html" }, extended_mode = false, max_file_lines = nil, }, + autotag = { enable = true }, + incremental_selection = { enable = true }, + indent = { enable = true, disable = { "python", "css" } }, + autopairs = { + enable = true, + }, }) diff --git a/lua/user/treesitter_20230205.lua b/lua/user/treesitter_20230205.lua new file mode 100644 index 0000000..b2d3a98 --- /dev/null +++ b/lua/user/treesitter_20230205.lua @@ -0,0 +1,56 @@ +local status_ok, configs = pcall(require, "nvim-treesitter.configs") +if not status_ok then + return +end + +configs.setup({ + ensure_installed = { + -- "bash", + -- "html", + -- "c", + -- "javascript", + "json", + "lua", + -- "python", + -- "typescript", + -- "tsx", + -- "css", + -- "rust", + -- "java", + -- "yaml", + -- "markdown", + -- "markdown_inline", + }, -- one of "all" or a list of languages + ignore_install = { "phpdoc" }, -- List of parsers to ignore installing + highlight = { + enable = true, -- false will disable the whole extension + disable = { "css" }, -- list of language that will be disabled + additional_vim_regex_highlighting = false, + }, + autopairs = { + enable = true, + }, + indent = { enable = true, disable = { "python", "css" } }, + context_commentstring = { + enable = true, + enable_autocmd = false, + config = { + -- Languages that have a single comment style + typescript = "// %s", + css = "/* %s */", + scss = "/* %s */", + html = "", + svelte = "", + vue = "", + json = "", + }, + }, + autotag = { enable = true }, + incremental_selection = { enable = true }, + rainbow = { + enable = true, + disable = { "html" }, + extended_mode = false, + max_file_lines = nil, + }, +})