2020-07-24 19:19:16 +00:00
|
|
|
# Neovim Treesitter Playground
|
2020-07-23 13:07:28 +00:00
|
|
|
|
2020-07-24 19:19:16 +00:00
|
|
|
View treesitter information directly in Neovim!
|
2020-07-23 13:07:28 +00:00
|
|
|
|
2020-07-24 19:19:16 +00:00
|
|
|
![nvim-treesitter-playground](demo.gif)
|
|
|
|
|
|
|
|
## Requirements
|
|
|
|
- Neovim [nightly](https://github.com/neovim/neovim#install-from-source)
|
|
|
|
- [nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter) plugin
|
|
|
|
|
|
|
|
## Setup
|
|
|
|
|
|
|
|
Install the plugin (vim-plug shown):
|
|
|
|
|
|
|
|
```vim
|
|
|
|
Plug 'nvim-treesitter/nvim-treesitter'
|
|
|
|
Plug 'nvim-treesitter/playground'
|
|
|
|
```
|
|
|
|
|
2020-07-29 13:37:57 +00:00
|
|
|
It's also recommended that you install the `query` parser for query editor highlighting. Run this after installing the above plugins.
|
|
|
|
|
|
|
|
```vim
|
|
|
|
:TSInstall query
|
|
|
|
```
|
|
|
|
|
2020-07-24 19:19:16 +00:00
|
|
|
The configuration is like any other nvim-treesitter module.
|
|
|
|
|
|
|
|
```lua
|
|
|
|
require "nvim-treesitter.configs".setup {
|
|
|
|
playground = {
|
|
|
|
enable = true,
|
|
|
|
disable = {},
|
|
|
|
updatetime = 25 -- Debounced time for highlighting nodes in the playground from source code
|
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2020-07-27 12:13:31 +00:00
|
|
|
## Usage
|
|
|
|
|
|
|
|
The tree can be toggled using the command `:TSPlaygroundToggle`.
|
|
|
|
|
2020-07-29 13:31:01 +00:00
|
|
|
### Keybindings
|
|
|
|
|
|
|
|
- 'R': Refreshes the playground view when focused or reloads the query when the query editor is focused.
|
|
|
|
- 'o': Toggles the query editor when the playground is focused
|
|
|
|
|
2020-07-24 19:19:16 +00:00
|
|
|
# Roadmap
|
|
|
|
- [ ] Add interactive query highlighting
|