vim-rainbows


Ⅰ. 插件描述

Vim runtime files for my own language, Rainbows

Ⅱ. 基本信息

创建日期:  2016-06-05
使用用户:  1
Github星:  6
插件作者:  Nate Fischer

Ⅲ. 安装方法

使用Vundle管理器安装

在你的.vimrc下添加:
Plugin 'nfischer/vim-rainbows'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall

对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。

使用NeoBundle管理器安装

在你的.vimrc下添加:
NeoBundle 'nfischer/vim-rainbows'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall

使用VimPlug管理器安装

在你的.vimrc下添加:
Plug 'nfischer/vim-rainbows'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall

使用Pathogen管理器安装

在终端中运行以下命令:
cd ~/.vim/bundle
git clone https://github.com/nfischer/vim-rainbows

Ⅳ. 文档说明

# 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 mapcolor/type
grrred/string
grbblue/int
groorange/float
grwwhite/bool
grggreen/list
grppurple/dict
grDreset 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 :sunglasses:
  • termguicolors: set this option in neovim or vim 8 and you can get the full
    power of the rainbow right in your terminal. :art:

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

  • [x] 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.

添加新评论