mirror of
https://github.com/JellyApple102/tree-sitter-dfraw.git
synced 2024-11-26 07:59:19 +02:00
update README
This commit is contained in:
parent
d2e3da39d4
commit
38dbfcdc11
30
README.md
30
README.md
|
@ -8,3 +8,33 @@ Please refer to the [adding parsers](https://github.com/nvim-treesitter/nvim-tre
|
||||||
|
|
||||||
In order for syntax highlighting to work you copy `queries/highlights.scm` file from this repo to your nvim-treesitter location `queries/dfraw/highlights.scm`.
|
In order for syntax highlighting to work you copy `queries/highlights.scm` file from this repo to your nvim-treesitter location `queries/dfraw/highlights.scm`.
|
||||||
More information can be found on the nvim-treesitter page.
|
More information can be found on the nvim-treesitter page.
|
||||||
|
|
||||||
|
Example config:
|
||||||
|
```lua
|
||||||
|
local parser_config = require'nvim-treesitter.parsers'.get_parser_configs()
|
||||||
|
parser_config.dfraw = {
|
||||||
|
install_info = {
|
||||||
|
url = 'https://github.com/JellyApple102/tree-sitter-dfraw',
|
||||||
|
files = { 'src/parser.c' },
|
||||||
|
branch = 'main'
|
||||||
|
},
|
||||||
|
filetype = 'text',
|
||||||
|
used_by = { 'dfraw' }
|
||||||
|
}
|
||||||
|
```
|
||||||
|
Wrap in `lua << EOF` and `EOF` to use in `init.vim`.
|
||||||
|
|
||||||
|
By default it is setup to start for any file of type 'text' or 'dfraw'. If you would not like to use it for all text files you can add a custom filetype to neovim.
|
||||||
|
Example `.config/nvim/scripts.vim`:
|
||||||
|
```vim
|
||||||
|
if did_filetype()
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
if getline(1) =~# '[a-z_]'
|
||||||
|
setfiletype dfraw
|
||||||
|
endif
|
||||||
|
```
|
||||||
|
This will match any file whose first line is just lowercase letters_and_underscores, and set the filetype to 'dfraw'.
|
||||||
|
Than change the config option `filetype = 'dfraw'` and remove the `used_by` option to only use 'dfraw' type files.
|
||||||
|
|
||||||
|
More information on custom filetypes [here](https://neovim.io/doc/user/filetype.html#new-filetype).
|
||||||
|
|
Loading…
Reference in New Issue