├── LICENSE.txt ├── README.md ├── ftdetect └── cook.vim └── syntax └── cook.vim /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2021 Luiz Ribeiro 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | SOFTWARE. 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # vim-cooklang 2 | 3 | A [cooklang](https://cooklang.org/) syntax highlighting plugin for vim. 4 | 5 | ## Installation 6 | 7 | Use your usual plugin manager. I personally use [vim-plug](https://github.com/junegunn/vim-plug). 8 | 9 | ### Plug 10 | 11 | ```vim 12 | Plug 'luizribeiro/vim-cooklang', { 'for': 'cook' } 13 | ``` 14 | -------------------------------------------------------------------------------- /ftdetect/cook.vim: -------------------------------------------------------------------------------- 1 | augroup cook 2 | autocmd BufRead,BufNewFile *.cook set filetype=cook 3 | autocmd BufRead,BufNewFile *.cook set synmaxcol=0 4 | augroup END 5 | -------------------------------------------------------------------------------- /syntax/cook.vim: -------------------------------------------------------------------------------- 1 | if exists('b:current_syntax') 2 | finish 3 | end 4 | 5 | syntax match cookNumbers "\([0-9]\+\.[0-9]\+\|[0-9/]\+\)" 6 | syntax match cookSymbol "@\|#\|\~" 7 | syntax match cookQuantityScaling "\*" 8 | syntax match cookUnit "%[^}]*" 9 | syntax match cookQuantity "{[^}]*}" 10 | \ contains=cookNumbers,cookUnit,cookQuantityScaling,cookSymbol 11 | 12 | " Ingredients 13 | syntax match cookIngredient "@[A-Za-z ]\{-}{[^}]*}\|@[A-Za-z]\+" 14 | \ contains=cookSymbol,cookQuantity 15 | 16 | " Metadata 17 | syntax match cookMetadataKey "[^:]\+:" 18 | syntax match cookMetadataPrefix "^>>" 19 | syntax region cookMetadata start="^>>" end="$" 20 | \ contains=cookMetadataPrefix,cookMetadataKey,cookMetadataValue 21 | 22 | " Cookware 23 | syntax match cookCookware "#[^#{]\{-}{}\|#[A-Za-z]\+" 24 | \ contains=cookSymbol,cookQuantity 25 | 26 | " Timer 27 | syntax match cookTimer "\~[^{]\{-}{[^}]*}" 28 | \ contains=cookNumbers,cookUnit,cookQuantityScaling,cookSymbol 29 | 30 | " Comments 31 | syntax keyword cookTodo contained TODO FIXME NOTE 32 | syntax match cookComment "--.*$" contains=cookTodo 33 | syntax match cookBlockComment "\[[^\]]*\]" contains=cookTodo 34 | 35 | highlight def link cookUnit Label 36 | highlight def link cookNumbers Number 37 | highlight def link cookQuantityScaling Operator 38 | highlight def link cookQuantity Statement 39 | highlight def link cookSymbol Function 40 | highlight def link cookIngredient Identifier 41 | highlight def link cookMetadataKey Identifier 42 | highlight def link cookMetadataPrefix Delimiter 43 | highlight def link cookMetadata String 44 | highlight def link cookCookware Type 45 | highlight def link cookTimer Number 46 | highlight def link cookTodo Todo 47 | highlight def link cookComment Comment 48 | highlight def link cookBlockComment Comment 49 | 50 | let b:current_syntax = 'cook' 51 | --------------------------------------------------------------------------------