From 7de8cb460e5dd7a488d849e91a8520933fc58400 Mon Sep 17 00:00:00 2001 From: Toby Vincent Date: Sat, 24 Dec 2022 14:59:15 -0600 Subject: feat(nvim,treesitter): improve treesitter config --- .../nvim/lua/tobyvin/plugins/treesitter.lua | 70 ++++++++++++++++++++-- 1 file changed, 64 insertions(+), 6 deletions(-) diff --git a/nvim/.config/nvim/lua/tobyvin/plugins/treesitter.lua b/nvim/.config/nvim/lua/tobyvin/plugins/treesitter.lua index 1138d06..6421a29 100644 --- a/nvim/.config/nvim/lua/tobyvin/plugins/treesitter.lua +++ b/nvim/.config/nvim/lua/tobyvin/plugins/treesitter.lua @@ -14,22 +14,75 @@ function M.config() local treesitter = require("nvim-treesitter.configs") treesitter.setup({ - ensure_installed = "all", + ensure_installed = { + "bash", + "c", + "cmake", + "cpp", + "css", + "diff", + "gitignore", + "go", + "graphql", + "html", + "java", + "javascript", + "jsdoc", + "jsonc", + "json", + "latex", + "lua", + "make", + "markdown", + "markdown_inline", + "python", + "query", + "regex", + "rust", + "scss", + "sql", + "svelte", + "teal", + "toml", + "tsx", + "typescript", + "vim", + "vue", + "yaml", + }, indent = { enable = true, }, highlight = { enable = true, - additional_vim_regex_highlighting = { "markdown" }, - disable = function(_, bufnr) - -- TODO: temp solution to ts highlighting screwing up formatting - return vim.api.nvim_buf_line_count(bufnr) > 2500 or vim.bo[bufnr].filetype == "help" - end, }, playground = { enable = true, }, textobjects = { + move = { + enable = true, + set_jumps = true, + goto_next_start = { + ["]p"] = "@parameter.inner", + ["]f"] = "@function.outer", + ["]]"] = "@class.outer", + }, + goto_next_end = { + ["]F"] = "@function.outer", + ["]["] = "@class.outer", + }, + goto_previous_start = { + ["[p"] = "@parameter.inner", + ["[f"] = "@function.outer", + ["[["] = "@class.outer", + }, + goto_previous_end = { + ["[F"] = "@function.outer", + ["[]"] = "@class.outer", + }, + }, + select = { enable = true, lookahead = true, @@ -57,6 +110,11 @@ function M.config() }, context_commentstring = { enable = true, + enable_autocmd = false, + config = { + c = "// %s", + lua = "-- %s", + }, }, }) end -- cgit v1.2.3-70-g09d2