From ae763be66884540d9ea9f3edb360392afedbf003 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Dudr?= Date: Tue, 4 Oct 2022 10:55:27 +0200 Subject: [PATCH] nvim: treesitter cleanup --- dot_config/nvim/lua/configs/packages.lua | 1 - dot_config/nvim/lua/configs/treesitter.lua | 69 +++++++++++----------- 2 files changed, 34 insertions(+), 36 deletions(-) diff --git a/dot_config/nvim/lua/configs/packages.lua b/dot_config/nvim/lua/configs/packages.lua index ca27c33..3b66374 100644 --- a/dot_config/nvim/lua/configs/packages.lua +++ b/dot_config/nvim/lua/configs/packages.lua @@ -43,7 +43,6 @@ function M.setup() config = require("configs.treesitter").setup, } use 'nvim-treesitter/playground' - use 'David-Kunz/treesitter-unit' use({ "yioneko/nvim-yati", requires = "nvim-treesitter/nvim-treesitter" }) use { 'nvim-telescope/telescope.nvim', diff --git a/dot_config/nvim/lua/configs/treesitter.lua b/dot_config/nvim/lua/configs/treesitter.lua index 08725ca..a67b560 100644 --- a/dot_config/nvim/lua/configs/treesitter.lua +++ b/dot_config/nvim/lua/configs/treesitter.lua @@ -1,43 +1,42 @@ local M = {} function M.setup() - require 'nvim-treesitter.configs'.setup { - ensure_installed = 'all', -- one of "all", "maintained" (parsers with maintainers), or a list of languages - highlight = { enable = true, }, - playground = { enable = true, }, - yati = { enable = true, }, - incremental_selection = { - enable = true, - keymaps = { - init_selection = "gnn", - node_incremental = "+", - scope_incremental = "grc", - node_decremental = "-", - }, - }, - indent = { - -- disable = { "php" },-- php indent SUCKS A LOT - enable = false, - }, - } + require 'nvim-treesitter.configs'.setup { + ensure_installed = 'all', -- one of "all", "maintained" (parsers with maintainers), or a list of languages + highlight = { + enable = true, + disable = { "help" }, + }, + playground = { enable = true, }, + yati = { enable = true, }, + incremental_selection = { + enable = true, + keymaps = { + init_selection = "gnn", + node_incremental = "+", + scope_incremental = "grc", + node_decremental = "-", + }, + }, + indent = { + -- disable = { "php" },-- php indent SUCKS A LOT + enable = false, + }, + } - local ts_parsers = require 'nvim-treesitter.parsers'.get_parser_configs() - ts_parsers.xml = { - install_info = { - url = "https://github.com/dorgnarg/tree-sitter-xml", -- local path or git repo - files = { "src/parser.c" }, - -- optional entries: - branch = "main", -- default branch in case of git repo if different from master - generate_requires_npm = false, -- if stand-alone parser without npm dependencies - requires_generate_from_grammar = true, -- if folder contains pre-generated src/parser.c - }, - filetype = "xml", -- if filetype does not match the parser name - } + local ts_parsers = require 'nvim-treesitter.parsers'.get_parser_configs() + ts_parsers.xml = { + install_info = { + url = "https://github.com/dorgnarg/tree-sitter-xml", -- local path or git repo + files = { "src/parser.c" }, + -- optional entries: + branch = "main", -- default branch in case of git repo if different from master + generate_requires_npm = false, -- if stand-alone parser without npm dependencies + requires_generate_from_grammar = true, -- if folder contains pre-generated src/parser.c + }, + filetype = "xml", -- if filetype does not match the parser name + } - vim.api.nvim_set_keymap('x', 'iu', ':lua require"treesitter-unit".select()', { noremap = true }) - vim.api.nvim_set_keymap('x', 'au', ':lua require"treesitter-unit".select(true)', { noremap = true }) - vim.api.nvim_set_keymap('o', 'iu', ':lua require"treesitter-unit".select()', { noremap = true }) - vim.api.nvim_set_keymap('o', 'au', ':lua require"treesitter-unit".select(true)', { noremap = true }) end return M