nvim: treesitter cleanup
This commit is contained in:
parent
909fcc62d0
commit
ae763be668
2 changed files with 34 additions and 36 deletions
|
@ -43,7 +43,6 @@ function M.setup()
|
||||||
config = require("configs.treesitter").setup,
|
config = require("configs.treesitter").setup,
|
||||||
}
|
}
|
||||||
use 'nvim-treesitter/playground'
|
use 'nvim-treesitter/playground'
|
||||||
use 'David-Kunz/treesitter-unit'
|
|
||||||
use({ "yioneko/nvim-yati", requires = "nvim-treesitter/nvim-treesitter" })
|
use({ "yioneko/nvim-yati", requires = "nvim-treesitter/nvim-treesitter" })
|
||||||
|
|
||||||
use { 'nvim-telescope/telescope.nvim',
|
use { 'nvim-telescope/telescope.nvim',
|
||||||
|
|
|
@ -1,43 +1,42 @@
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
function M.setup()
|
function M.setup()
|
||||||
require 'nvim-treesitter.configs'.setup {
|
require 'nvim-treesitter.configs'.setup {
|
||||||
ensure_installed = 'all', -- one of "all", "maintained" (parsers with maintainers), or a list of languages
|
ensure_installed = 'all', -- one of "all", "maintained" (parsers with maintainers), or a list of languages
|
||||||
highlight = { enable = true, },
|
highlight = {
|
||||||
playground = { enable = true, },
|
enable = true,
|
||||||
yati = { enable = true, },
|
disable = { "help" },
|
||||||
incremental_selection = {
|
},
|
||||||
enable = true,
|
playground = { enable = true, },
|
||||||
keymaps = {
|
yati = { enable = true, },
|
||||||
init_selection = "gnn",
|
incremental_selection = {
|
||||||
node_incremental = "+",
|
enable = true,
|
||||||
scope_incremental = "grc",
|
keymaps = {
|
||||||
node_decremental = "-",
|
init_selection = "gnn",
|
||||||
},
|
node_incremental = "+",
|
||||||
},
|
scope_incremental = "grc",
|
||||||
indent = {
|
node_decremental = "-",
|
||||||
-- disable = { "php" },-- php indent SUCKS A LOT
|
},
|
||||||
enable = false,
|
},
|
||||||
},
|
indent = {
|
||||||
}
|
-- disable = { "php" },-- php indent SUCKS A LOT
|
||||||
|
enable = false,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
local ts_parsers = require 'nvim-treesitter.parsers'.get_parser_configs()
|
local ts_parsers = require 'nvim-treesitter.parsers'.get_parser_configs()
|
||||||
ts_parsers.xml = {
|
ts_parsers.xml = {
|
||||||
install_info = {
|
install_info = {
|
||||||
url = "https://github.com/dorgnarg/tree-sitter-xml", -- local path or git repo
|
url = "https://github.com/dorgnarg/tree-sitter-xml", -- local path or git repo
|
||||||
files = { "src/parser.c" },
|
files = { "src/parser.c" },
|
||||||
-- optional entries:
|
-- optional entries:
|
||||||
branch = "main", -- default branch in case of git repo if different from master
|
branch = "main", -- default branch in case of git repo if different from master
|
||||||
generate_requires_npm = false, -- if stand-alone parser without npm dependencies
|
generate_requires_npm = false, -- if stand-alone parser without npm dependencies
|
||||||
requires_generate_from_grammar = true, -- if folder contains pre-generated src/parser.c
|
requires_generate_from_grammar = true, -- if folder contains pre-generated src/parser.c
|
||||||
},
|
},
|
||||||
filetype = "xml", -- if filetype does not match the parser name
|
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
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
Loading…
Add table
Reference in a new issue