56 lines
909 B
Markdown
56 lines
909 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
|
|
|
|
Add to your Neovim config:
|
|
|
|
```lua
|
|
vim.filetype.add({
|
|
extension = {
|
|
srf = "srf",
|
|
},
|
|
})
|
|
|
|
vim.api.nvim_create_autocmd("User", {
|
|
pattern = "TSUpdate",
|
|
callback = function()
|
|
require("nvim-treesitter.parsers").srf = {
|
|
install_info = {
|
|
url = "https://github.com/elerch/srf-tree-sitter",
|
|
branch = "master",
|
|
queries = "queries",
|
|
},
|
|
}
|
|
vim.treesitter.language.register("srf", "srf")
|
|
end,
|
|
})
|
|
|
|
vim.api.nvim_create_autocmd("FileType", {
|
|
pattern = "srf",
|
|
callback = function(args)
|
|
pcall(vim.treesitter.start, args.buf)
|
|
end,
|
|
})
|
|
```
|
|
|
|
Then install the parser:
|
|
|
|
```vim
|
|
:TSInstall srf
|
|
```
|