vim-react-es6-snippets


Ⅰ. 插件描述

vim ultisnips snippets for React, using es6 syntax

Ⅱ. 基本信息

创建日期:  2014-11-21
使用用户:  4
Github星:  10
插件作者:  Gregory Scheerlinck

Ⅲ. 安装方法

使用Vundle管理器安装

在你的.vimrc下添加:
Plugin 'greg-js/vim-react-es6-snippets-own-character'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall

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

使用NeoBundle管理器安装

在你的.vimrc下添加:
NeoBundle 'greg-js/vim-react-es6-snippets-own-character'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall

使用VimPlug管理器安装

在你的.vimrc下添加:
Plug 'greg-js/vim-react-es6-snippets-own-character'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall

使用Pathogen管理器安装

在终端中运行以下命令:
cd ~/.vim/bundle
git clone https://github.com/greg-js/vim-react-es6-snippets

Ⅳ. 文档说明

Note: justinj's snipmate snippets originally ported to ES6 by bentayloruk, I only use Ultisnips so those are the only ones I've tested

vim-react-es6-snippets

A set of snippets for Vim to work with Facebook's React library.

A direct port of the awesome snippets from
justinj/vim-react-snippets.

Requires UltiSnips.

Installation

Use your preferred (neo)vim plugin installation method or just copy the snippets over to the relevant folder.

Usage

Within any Javascript or JSX file, you should be able to do the following:

(in insert mode)

gdp<Tab>

expanding to

getDefaultProps() {
    return {

    };
},

And a bunch of others!

You may have to set g:UltiSnipsExpandTrigger and g:UltiSnipsJumpForwardTrigger, depending on which other tab-based plugins you have installed. I personally use Control+j. Check the UltiSnips help page for more info and UltiSnips/javascript.snippets in this repo to see the full snippet list.

添加新评论