Nvim Treesitter configurations and abstraction layer
Find a file
TravonteD 79ab9fc6fb Squashed commit of the following:
commit 1b3700b0cd68cb507c64b7243a5bea050379f09c
Author: TravonteD <tman1300@aol.com>
Date:   Fri Apr 24 08:44:34 2020 -0400

    remove local from the capture groups

commit 62f1a613c7c6f26e3a85f06f322ead28280dc7ca
Author: TravonteD <tman1300@aol.com>
Date:   Thu Apr 23 18:43:09 2020 -0400

    update captures for identifiers

commit 9966d5a9cd780b2de80e620cee6833fd341028d0
Author: TravonteD <tman1300@aol.com>
Date:   Thu Apr 23 18:42:42 2020 -0400

    add capture for constants that are recievers of a method call

commit 10f03606710a3a54c8c722e4883b9475c6f9f776
Author: TravonteD <tman1300@aol.com>
Date:   Thu Apr 23 17:54:25 2020 -0400

    update captures for function definitions and calls

commit 4b350274cb02e1b69ae013fa157bae5c6be9e577
Author: TravonteD <tman1300@aol.com>
Date:   Thu Apr 23 17:21:10 2020 -0400

    update captures for operators

commit c66d42cd0d56d0a1bbfb1f88ffa7ff6ae8b6c2df
Author: TravonteD <tman1300@aol.com>
Date:   Thu Apr 23 17:10:13 2020 -0400

    update captures for literals

commit a9c097fe03f7294fdaede760f2c016cf6c960a45
Author: TravonteD <tman1300@aol.com>
Date:   Thu Apr 23 15:54:47 2020 -0400

    add highlights and locals from treesitter-ruby
2020-04-24 08:48:18 -04:00
autoload/health feat: add checkhealth 2020-04-21 13:38:16 +02:00
lua fix: add -fPIC flag to compiling 2020-04-23 13:48:20 +08:00
parser add parser installer 2020-04-19 15:13:38 +02:00
plugin feat/refacto: add configs.lua, setup install 2020-04-21 23:40:23 +02:00
queries Squashed commit of the following: 2020-04-24 08:48:18 -04:00
.editorconfig style: add editorconfig 2020-04-18 17:39:03 +02:00
README.md Update README.md 2020-04-22 19:47:09 +02:00

Gitter

nvim-treesitter

Treesitter configurations and abstraction layer for Neovim.

Quickstart

Requirements

  • Neovim nightly
  • git in your path.
  • A C compiler in your path.

Installation

You can install nvim-treesitter with your favorite package manager, or using the default pack feature of neovim !

Using a package manager

Simply add these lines to your init.vim :

Plug 'nvim-treesitter/nvim-treesitter'

Using neovim pack feature

We highly recommend reading :h packages to learn more about this feature, but you can still follow these steps:

$ mkdir -p ~/.local/share/nvim/site/pack/nvim-treesitter/start
$ cd ~/.local/share/nvim/site/pack/nvim-treesitter/start
$ git clone https://github.com/nvim-treesitter/nvim-treesitter.git

Adding parsers

Treesitter is using a different parser for every language. It can be quite a pain to install, but fortunately nvim-treesitter provides two command to tackle this issue:

  • TSInstall to install a given parser.
  • TSInstallInfo to know which parser is installed.

Let's say you need parsers for lua, c, and python, this is how you do with these commands:

:TSInstall c
Downloading...
Compiling...
Treesitter parser for c has been installed

:TSInstall lua
Downloading...
Compiling...
Treesitter parser for lua has been installed

:TSInstall python
Downloading...
Compiling...
Treesitter parser for python has been installed

Cool, lets see which parsers are installed:

:TSInstallInfo
csharp     [✗] not installed
html       [✗] not installed
typescript [✗] not installed
c          [✓] installed
swift      [✗] not installed
java       [✗] not installed
python     [] installed
cpp        [✗] not installed
lua        [✓] installed
ruby       [✗] not installed
ocaml      [✗] not installed
go         [✗] not installed
rust       [✗] not installed
json       [✗] not installed
javascript [✗] not installed
css        [✗] not installed
julia      [✗] not installed
php        [✗] not installed
bash       [✗] not installed
tsx        [✗] not installed

And now you should be able to use every functionnality nvim-treesitter provides !

Features and Roadmap

The goal of nvim-treesitter is both to provide a simple and easy way to use the interface for treesitter in neovim, but also to add some functionnalities to it: Some of these features are :

  • Incremental selection
  • Syntax based code folding
  • Consistent syntax highlighting

You can find the roadmap here. The roadmap and all features of this plugin are open to change, and any suggestion will be highly apreciated !

Troubleshooting

Before doing anything run :checkhealth nvim_treesitter. This will help you find where the bug might come from.

Feature X does not work for language Y...

First, check the ## Y parser healthcheck section of :checkhealth if you have any warning. If you do, it's highly possible that this is the cause of the problem. If everything is okay, then it might be an actual error.

In both cases, feel free to open an issue here.