diff options
Diffstat (limited to 'js/baba-yaga/dev/vim')
-rw-r--r-- | js/baba-yaga/dev/vim/README.md | 95 | ||||
-rw-r--r-- | js/baba-yaga/dev/vim/ftdetect/baba.vim | 2 | ||||
-rw-r--r-- | js/baba-yaga/dev/vim/syntax/baba.vim | 93 |
3 files changed, 190 insertions, 0 deletions
diff --git a/js/baba-yaga/dev/vim/README.md b/js/baba-yaga/dev/vim/README.md new file mode 100644 index 0000000..fb1090e --- /dev/null +++ b/js/baba-yaga/dev/vim/README.md @@ -0,0 +1,95 @@ +# Baba Yaga Vim/NeoVim Syntax + +Syntax highlighting for the Baba Yaga programming language in Vim and NeoVim. + +## Installation + +### Method 1: Manual Installation +1. Copy the files to your Vim runtime directory: + ```bash + # For Vim + cp syntax/baba.vim ~/.vim/syntax/ + cp ftdetect/baba.vim ~/.vim/ftdetect/ + + # For NeoVim + cp syntax/baba.vim ~/.config/nvim/syntax/ + cp ftdetect/baba.vim ~/.config/nvim/ftdetect/ + ``` + +2. Restart Vim/NeoVim + +### Method 2: Using a Plugin Manager (Recommended) + +#### Vim-Plug +Add to your `.vimrc` or `init.vim`: +```vim +Plug 'your-username/baba-yaga', { 'rtp': 'dev/vim' } +``` + +#### Vundle +Add to your `.vimrc`: +```vim +Plugin 'your-username/baba-yaga' +``` + +#### NeoVim with Packer +Add to your `init.lua`: +```lua +use { + 'your-username/baba-yaga', + config = function() + vim.cmd('set runtimepath+=dev/vim') + end +} +``` + +### Method 3: Using Pathogen +```bash +cd ~/.vim/bundle +git clone https://github.com/your-username/baba-yaga.git +``` + +## Features +- Syntax highlighting for Baba Yaga language +- Automatic filetype detection for `.baba` files +- Highlighting for: + - Keywords (when, then, is, with, etc.) + - Types (Bool, Int, Float, String, etc.) + - Operators (->, =>, +, -, etc.) + - Functions and variables + - Strings and numbers + - Comments (// and /* */) + - When expressions + - Lists and tables + - IO functions (io.out, io.in, etc.) + +## Usage +Open any `.baba` file and Vim/NeoVim should automatically detect the language and apply syntax highlighting. + +## Customization +You can customize the colors by modifying your color scheme or adding custom highlighting: + +```vim +" Add to your .vimrc or init.vim +hi babaKeyword ctermfg=blue guifg=blue +hi babaType ctermfg=green guifg=green +hi babaOperator ctermfg=red guifg=red +``` + +## File Structure +``` +dev/vim/ +├── syntax/ +│ └── baba.vim # Syntax highlighting rules +├── ftdetect/ +│ └── baba.vim # Filetype detection +└── README.md # This file +``` + +## Troubleshooting +If syntax highlighting doesn't work: + +1. Check that the files are in the correct directories +2. Verify filetype detection: `:set filetype?` +3. Force syntax highlighting: `:set syntax=baba` +4. Check for syntax errors: `:syntax sync fromstart` diff --git a/js/baba-yaga/dev/vim/ftdetect/baba.vim b/js/baba-yaga/dev/vim/ftdetect/baba.vim new file mode 100644 index 0000000..433aa0b --- /dev/null +++ b/js/baba-yaga/dev/vim/ftdetect/baba.vim @@ -0,0 +1,2 @@ +" Filetype detection for Baba Yaga +autocmd BufNewFile,BufRead *.baba set filetype=baba diff --git a/js/baba-yaga/dev/vim/syntax/baba.vim b/js/baba-yaga/dev/vim/syntax/baba.vim new file mode 100644 index 0000000..cc9a70f --- /dev/null +++ b/js/baba-yaga/dev/vim/syntax/baba.vim @@ -0,0 +1,93 @@ +" Vim syntax file for Baba Yaga programming language +" Language: Baba Yaga +" Maintainer: Your Name <your-email@example.com> +" Latest Revision: 2024 + +if exists("b:current_syntax") + finish +endif + +" Keywords +syn keyword babaKeyword when then is Ok Err +syn keyword babaType Bool Int Float String List Table Result Number +syn keyword babaOperator append set merge shape +syn keyword babaIO io.out io.in io.emit io.listen +syn keyword babaFunction map filter reduce pipe + +" Operators +syn match babaOperator "->" +syn match babaOperator "=>" +syn match babaOperator "\.\." +syn match babaOperator "=" +syn match babaOperator ">" +syn match babaOperator "<" +syn match babaOperator ">=" +syn match babaOperator "<=" +syn match babaOperator "+" +syn match babaOperator "-" +syn match babaOperator "\*" +syn match babaOperator "/" +syn match babaOperator "%" +syn match babaOperator ":" + +" Comments +syn match babaComment "//.*$" +syn region babaComment start="/\*" end="\*/" + +" Strings +syn region babaString start='"' end='"' skip='\\"' + +" Numbers +syn match babaNumber "\b\d\+\b" +syn match babaFloat "\b\d\+\.\d\+\b" + +" Function definitions +syn match babaFunctionDef "\b[a-zA-Z_][a-zA-Z0-9_]*\s*:" + +" Variables +syn match babaVariable "\b[a-zA-Z_][a-zA-Z0-9_]*\b" + +" With blocks +syn keyword babaWith with +syn keyword babaWithRec rec +syn region babaWithBlock start="\bwith\b" end="->" contains=babaWith,babaWithRec,babaKeyword,babaOperator,babaString,babaNumber,babaVariable,babaComment,babaWithBlockEntry +syn region babaWithBlockEntry start="\b[a-zA-Z_][a-zA-Z0-9_]*\s*:" end=";" contains=babaVariable,babaOperator,babaString,babaNumber,babaComment,babaWhenExpr + +" When expressions +syn region babaWhenExpr start="\bwhen\b" end=";" contains=babaKeyword,babaOperator,babaString,babaNumber,babaVariable + +" Anonymous functions +syn region babaAnonFunc start="(" end=")" contains=babaVariable,babaOperator + +" Lists +syn region babaList start="\[" end="\]" contains=ALL + +" Tables +syn region babaTable start="{" end="}" contains=ALL + +" Wildcard +syn match babaWildcard "\b_\b" + +" Define highlighting +hi def link babaKeyword Keyword +hi def link babaType Type +hi def link babaOperator Operator +hi def link babaIO PreProc +hi def link babaFunction Function +hi def link babaComment Comment +hi def link babaString String +hi def link babaNumber Number +hi def link babaFloat Float +hi def link babaFunctionDef Function +hi def link babaVariable Identifier +hi def link babaWith Keyword +hi def link babaWithRec Keyword +hi def link babaWithBlock Special +hi def link babaWithBlockEntry Special +hi def link babaWhenExpr Special +hi def link babaAnonFunc Special +hi def link babaList Special +hi def link babaTable Special +hi def link babaWildcard Constant + +let b:current_syntax = "baba" |