Vim runtime files for my own language, Rainbows.
The power of vim meets the power of the rainbow
Using vim-plug:
Plug 'google/vim-maktaba' " This is a dependency
Plug 'nfischer/vim-rainbows'
Using vundle:
Plugin 'google/vim-maktaba' " This is a dependency
Plugin 'nfischer/vim-rainbows'
Rainbows is all about coding in color! Now you can do that, all from within vim!
To get started, visit the live demo
and download the files (this should be a .rain
and .raint
file).
Next, open up the .rain
file and start hacking away!
- type coloring: just like the live coding environment, this will color your identifiers and literals based on what type they are.
- type inference: if you have the type inferencer installed (see below), then this will automatically run that after each save.
- custom coloring: don't like what types the inferencer chose? Just custom color the identifiers with a few key presses (see below). Changes will persist between vim sessions!
Here are the allowed commands, which should all be entered in normal mode on top of the token you want to paint
key map | color/type |
---|---|
grr |
red/string |
grb |
blue/int |
gro |
orange/float |
grw |
white/bool |
grg |
green/list |
grp |
purple/dict |
grD |
reset to default |
If you have Rainbows installed, you can specify the path to the type inferencer, and it'll run after every save:
" In .vimrc
let g:rainbows#inferencer_path = '/path/to/rainbows/bin/rain-infer.js'
Try out neovim
- gvim has the full range of terminal colors by default 😎
termguicolors
: set this option in neovim or vim 8 and you can get the full power of the rainbow right in your terminal. 🎨
- Invoke commands with
Rr
,Rb
,Ro
, etc.
let g:rainbows#map_prefix = 'R'
- Reset the default color with the mapping
grC
instead
let g:rainbows#default_key = 'C'
- Change the key/color mapping to something that's easier for you
let g:rainbows#custom_map = {
\ 's': 'string',
\ 'i': 'int',
\ 'f': 'float',
\ 'b': 'bool',
\ 'l': 'list',
\ 'd': 'dict'
\ }
- Run the type inferencer after every save
let g:rainbows#inferencer_path = '/path/to/rainbows/bin/rain-infer.js'
- Async support for neovim users (so we can run the inferencer in the background, then update the UI when it's done)
- Unit tests... yeah right
Let me know! Either post an issue, or send a PR my way. This is still super experimental, and very closely tied to the language itself, so anything is up for grabs.