Vim-ungrammar
is a plugin for Neovim and Vim for the Ungrammar filetype which provides:
- Filetype detection.
ftplugin
setting adjustments.- Use
let g:ungrammar_formatting = v:false
to turn it off.
- Use
- Syntax files.
Here is a preview of the syntax highlighting, using nvim-highlite as a theme:
This plugin defines the following syntax groups:
Group Name | Description | Example |
---|---|---|
ungramAlternation |
An alternation on a rule. | | |
ungramConditionalGroup |
A group which is a conditional. | (Foo|Bar)? |
ungramConditionalString |
A conditional ungramString . |
'for'? |
ungramConditional |
A conditional (1-or-0). | ? |
ungramLabel |
A label for a token or string. | scope:'local' |
ungramOperator |
An operator. | = |
ungramOr |
Alternative for a given position. | Foo|Bar |
ungramQuote |
A quote for a string or token. | ' |
ungramRepeatGroup |
A group which is repeated. | (Foo|Bar)* |
ungramRepeatString |
A repeated ungramString . |
'for'* |
ungramRepeat |
0 or more repetitions. | * |
ungramRule |
A rule for a grammar. | Foo |
ungramString |
A specific string of characters. | 'for' |
ungramToken |
A token. | 'identifier_var' |
You can use this plugin seamlessly with plasticboy/vim-markdown provided that the following is part of your init.vim
configuration:
let g:vim_markdown_fenced_languages = ['ungram=ungrammar']
Then, you can create codeblocks in markdown and it will use the syntax file from this plugin:
```ungram
Foo = 'A' | 'B'
- Learn Vimscript The Hard Way got me started.
- plasticboy wrote a fantastic markdown plugin with syntax highlighting for fenced code blocks.
- rust-analyzer/ungrammar created the syntax and initial implementation.
- tbastos/vim-lua open sourced a clear example of syntax files.