52 lines
910 B
Markdown
52 lines
910 B
Markdown
# srf-tree-sitter
|
|
|
|
Tree-sitter grammar for [SRF (Simple Record Format)](https://git.lerch.org/lobo/srf).
|
|
|
|
## Setup
|
|
|
|
```sh
|
|
mise install
|
|
npm install
|
|
```
|
|
|
|
## Build & Test
|
|
|
|
```sh
|
|
mise exec -- tree-sitter generate
|
|
mise exec -- tree-sitter test
|
|
```
|
|
|
|
## Neovim Integration
|
|
|
|
Register the parser and configure highlighting in your Neovim config:
|
|
|
|
```lua
|
|
local parser_config = require("nvim-treesitter.parsers").get_parser_configs()
|
|
parser_config.srf = {
|
|
install_info = {
|
|
url = "https://git.lerch.org/lobo/srf-tree-sitter.git",
|
|
files = { "src/parser.c" },
|
|
branch = "main",
|
|
},
|
|
filetype = "srf",
|
|
}
|
|
|
|
vim.filetype.add({
|
|
extension = {
|
|
srf = "srf",
|
|
},
|
|
})
|
|
```
|
|
|
|
Then install the parser:
|
|
|
|
```vim
|
|
:TSInstall srf
|
|
```
|
|
|
|
Copy `queries/highlights.scm` to your Neovim runtime queries directory:
|
|
|
|
```sh
|
|
mkdir -p ~/.config/nvim/queries/srf
|
|
cp queries/highlights.scm ~/.config/nvim/queries/srf/highlights.scm
|
|
```
|