1
0
Fork 0

nvim: treesitter cleanup

This commit is contained in:
Vladimír Dudr 2022-10-04 10:55:27 +02:00
parent 909fcc62d0
commit ae763be668
2 changed files with 34 additions and 36 deletions
dot_config/nvim/lua/configs

View file

@ -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',

View file

@ -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()<CR>', { noremap = true })
vim.api.nvim_set_keymap('x', 'au', ':lua require"treesitter-unit".select(true)<CR>', { noremap = true })
vim.api.nvim_set_keymap('o', 'iu', ':<c-u>lua require"treesitter-unit".select()<CR>', { noremap = true })
vim.api.nvim_set_keymap('o', 'au', ':<c-u>lua require"treesitter-unit".select(true)<CR>', { noremap = true })
end
return M