Questions tagged [plugin-treesitter]
Gather question about the installation and the utilization of the vim-treesitter Neovim plugin
23
questions
0
votes
0
answers
71
views
Nvim+Treesitter gives me language highlights in markdown code blocks, how do I set custom highlights?
When writing technical documentation in markdown, Neovim and Treesitter will provide language formatting for triple back-tick code blocks ```cpp
For example:
int main() { printf("hello world\n&...
1
vote
1
answer
114
views
How do I use tree-sitter to change syntax highlighting for different kinds of identifiers?
I'm using coc-clangd and nvim-treesitter in NeoVim, and I have the following requirements.
set the global variable identifiers to bold
set the virtual function identifiers to italic
set the macro ...
1
vote
0
answers
49
views
How can I jump to a sibling node in Neovim?
Say I want to write a custom function / keyboard shortcut to jump to the next sibling node in Neovim/Lua. In theory, I can get that with TSNode:next_sibling(). But I'm lost as to how I would put the ...
1
vote
1
answer
250
views
Turn tree-sitter queries into folding
I have the following config in my ftplugin/groovy.lua:
vim.opt.foldmethod = "expr"
vim.opt.foldexpr = "nvim_treesitter#foldexpr()"
I simply want every region that constitutes a ...
0
votes
0
answers
355
views
Neovim tries to run vale through a Autocommand
Whenever I save a .txt file it I get the error:
Error detected while processing BufWritePost Autocommands for "*":
Error running vale: ENOENT: no such file or directory
I have tried using :...
0
votes
0
answers
31
views
How can I have treesitter have a decent visual fallback when it panics?
Treesitter is very often panicking and refusing to parse stuff on my Windows machine. How can I survive this and still be able to modify the file smoothly, maybe by falling back to some more basic ...
5
votes
1
answer
1k
views
Use treesitter to jump to next argument without going into nested function calls
I'm hoping to write a macro that involves jumping to a second argument of a function call and deleting it. The function arguments will sometimes include nested function calls, sometimes not, will ...
0
votes
1
answer
394
views
(nvim-treesitter) How to disable hyperlink highlighting in tree-sitter-markdown?
I installed tree-sitter-markdown in my nvim for editing the md files. However, it seems it highlights the links and hides the url part. This often annoys me when I edit url/paths.
You can see it in ...
1
vote
1
answer
1k
views
How to install nvim-html-css neovim plugin in NvChad
Neovim plugin: nvim-html-css
I don't know lua but I need this plugin installed for bootstrap classes. I have Neovim NvChad lazy.nvim setup. Copy pasting didn't worked so I tried to cut out maybe ...
2
votes
0
answers
119
views
Move cursor to matching goto/jump/label
Goto/label statement pairs are available in C++, Visual Basic, JavaScript, Fortran, and other languages, too.
The unique word or number allows goto to find the associated label. How can I help vim ...
2
votes
1
answer
3k
views
How to setup treesitter in vim script?
I have my entire nvim setup written in vim script at ~/.config/nvim/init.vim, but tresitter on it's GitHub says
require'nvim-treesitter.configs'.setup {
-- A list of parser names, or "all" ...
0
votes
1
answer
564
views
TSEnable highlight - true by default
I'm using the plugin 'nvim-treesitter/nvim-treesitter', and I can enable syntax highlighting by using the command:
:TSEnable highlight
However, once I close n/vim it reverts back to disabled. I'm ...
1
vote
2
answers
1k
views
Is there a way to disable Treesitter in Telescope?
I have max file size rule for files, setup in treesitter config, it works:
require 'nvim-treesitter.configs'.setup {
highlight = {
enable = true,
is_supported = function()
if vim.fn.strwidth(...
1
vote
1
answer
3k
views
Vanilla tree-sitter setup not enables highlighting automatically
I am failing to configure nvim-treesitter to automatically highlight the code upon opening a file.
After configuring nvim-treesitter by following the recommended instruction steps, this is what I get:
...
-1
votes
1
answer
473
views
vimtex#syntax#in_mathzone with tree-sitter and texlab
Vimtex provides the very useful family of functions vimtex#syntax#in_mathzone(), vimtex#syntax#in_comment() and vimtex#env#is_inside('...'), which come in handy for context sensitive snippets, e.g. ...
1
vote
1
answer
112
views
synstack is always empty
Whenever I do :echo synstack(line("."), col(".")) it prints []
I've tried this in html and svelte files in my neovim with treesitter, in neovim with -u NONE, and in Vim 9 with -u ...
0
votes
1
answer
814
views
How to get list of highlight groups for a region under cursor? (problem with synIDtrans function)
My purpose is to get information which would explain why the region under cursor has that particular color. Yes, there are several very similar questions, but still my question is different.
I can get ...
1
vote
2
answers
4k
views
Color theme displayed wrong
I could really use some help here...
I have just migrated my nvim setup to all Lua and changed some plugins.
I have added nvim-treesitter and tried a few themes. The themes change OK and get applied, ...
2
votes
0
answers
63
views
Parse files, hidden from the user
I am working on a snippet for C/C++ that can generate switch statements with cases from the types that an enum can have.
So far I have some code that can get the type location from the language server....
0
votes
2
answers
1k
views
How to install vim-treesitter?
I have installed neovim, it was cool so I installed vim-treesitter plugin.
I'm trying to use it but I get some error message.
I can't find solution about it.
Could you help me?
This is the error ...
5
votes
2
answers
9k
views
JSX highlighting with Neovim and nvim-treesitter
I'm using Neovim 0.6.0 with nvim-treesitter installed and I mostly work with JavaScript, Flow, TypeScript based React projects. This means, I also need syntax highlighting for JSX and TSX.
Syntax ...
1
vote
1
answer
4k
views
Syntax highlighting is incomplete on neovim, fixed by calling Telescope
I have this problem that I would really like to get to the bottom of.
If I open a file on neovim it will display like the broken syntax highlighting, see image below.
Now, If I run :Telescope ...
2
votes
0
answers
707
views
Cannot get current node tree with treesitter in Lua in nvim
I am trying to get the AST tree to find the node I want. Based on the doc, I should be able to get the tree like this:
local parser = vim.treesitter.get_parser(0, vim.o.filetype)
print('check ...