update readme with proper install instructions
This commit is contained in:
parent
cb9234aeef
commit
eacd98c7ff
1 changed files with 22 additions and 18 deletions
40
README.md
40
README.md
|
|
@ -18,24 +18,35 @@ mise exec -- tree-sitter test
|
||||||
|
|
||||||
## Neovim Integration
|
## Neovim Integration
|
||||||
|
|
||||||
Register the parser and configure highlighting in your Neovim config:
|
Add to your Neovim config:
|
||||||
|
|
||||||
```lua
|
```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({
|
vim.filetype.add({
|
||||||
extension = {
|
extension = {
|
||||||
srf = "srf",
|
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:
|
Then install the parser:
|
||||||
|
|
@ -43,10 +54,3 @@ Then install the parser:
|
||||||
```vim
|
```vim
|
||||||
:TSInstall srf
|
: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
|
|
||||||
```
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue