Skip to content

nfischer/vim-rainbows

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vim-rainbows

Vim runtime files for my own language, Rainbows.

The power of vim meets the power of the rainbow

Installation

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'

How do I use it?

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!

What does this do for me?

  • 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

But wait, there's more!

Want this to do type inference?

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'

Want the inferencer to run in the background?

Try out neovim

Don't like the default colors in terminal vim?

  • 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. 🎨

Customization

  • 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'

Coming soon...

  • 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

Want something more?

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.

About

Vim runtime files for my own language, Rainbows

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published