nvim: treesitter: Enable playground

Helps to see what treesitter queries are being made. Would be helpful in
tuning the color scheme.
This commit is contained in:
Sanchayan Maity 2021-06-19 14:47:48 +05:30
parent 0649b639da
commit 44a39eee24
3 changed files with 29 additions and 1 deletions

View file

@ -116,6 +116,7 @@ remap('c', '<Tab>', 'getcmdtype() =~ \'[?/]\' ? \'<C-g>\' : feedkeys(\'<Tab>\'
remap('c', '<S-Tab>', 'getcmdtype() =~ \'[?/]\' ? \'<C-t>\' : feedkeys(\'<S-Tab>\', \'int\')[1]', { noremap = true, expr = true })
remap('n', '<F1>', ':call SyntaxAttr#SyntaxAttr()<CR>', { noremap = true })
remap('n', '<F2>', ':TSHighlightCapturesUnderCursor<CR>', { noremap = true })
-- After shifting a visual block, select it again
remap('v', '<', '<gv', { noremap = true })

View file

@ -101,6 +101,7 @@ local init = function ()
requires = { 'nvim-treesitter/nvim-treesitter' },
config = "require('treesitter')",
}
use 'nvim-treesitter/playground'
-- All writing needs
use 'lervag/vimtex'
use 'vim-pandoc/vim-pandoc'

View file

@ -1,5 +1,5 @@
require'nvim-treesitter.configs'.setup {
ensure_installed = { "bash", "c", "clojure", "cpp", "fennel", "fish", "java", "javascript", "jsdoc", "json", "lua", "nix", "python", "rust", "toml" },
ensure_installed = { "bash", "c", "clojure", "cpp", "fennel", "fish", "java", "javascript", "jsdoc", "json", "lua", "nix", "python", "query", "rust", "toml" },
highlight = { enable = true, },
textobjects = {
select = {
@ -25,6 +25,32 @@ require'nvim-treesitter.configs'.setup {
},
},
},
query_linter = {
enable = true,
use_virtual_text = true,
lint_events = { "BufWrite", "CursorHold" },
},
}
require'nvim-treesitter.install'.compilers = { "gcc" }
require "nvim-treesitter.configs".setup {
playground = {
enable = true,
disable = {},
updatetime = 25,
persist_queries = false,
keybindings = {
toggle_query_editor = 'o',
toggle_hl_groups = 'i',
toggle_injected_languages = 't',
toggle_anonymous_nodes = 'a',
toggle_language_display = 'I',
focus_language = 'f',
unfocus_language = 'F',
update = 'R',
goto_node = '<CR>',
show_help = '?',
},
}
}