vim-react-snippets


Ⅰ. 插件描述

Vim version of the snippets from jgebhardt/sublime-react

Ⅱ. 基本信息

创建日期:  2014-03-18
使用用户:  137
Github星:  129
插件作者:  Justin Jaffray

Ⅲ. 安装方法

使用Vundle管理器安装

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

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

使用NeoBundle管理器安装

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

使用VimPlug管理器安装

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

使用Pathogen管理器安装

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

Ⅳ. 文档说明

vim-react-snippets

A set of snippets for Vim to work with Facebook's
React library. This fork change the snippet
syntax to ES6. Remove semicolon and comma. I also remove snippets related to
react-classset as it is deprecated now.

Require UltiSnips.
I only update the UltiSnips version. Pull requests for
vim-snipmate version are welcome.

Installation

Use your preferred Vim plugin installation method. For me, I like
vim-plug. If you also using vim-plug,
put the following into your .vimrc.

Plug 'SirVer/ultisnips'

" Currently, es6 version of snippets is available in es6 branch only
Plug 'letientai299/vim-react-snippets', { 'branch': 'es6' }

Plug 'honza/vim-snippets' "optional

Usage

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

(in insert mode)

gdp<Tab>

expanding to

getDefaultProps() {
    return {

    };
},

Another example:

rcx<Tab>

Expanding to

class ClassName extends React.Component {
  render(){
    return (

    )
  }
}

And a bunch of others!

Check ./UltiSnips/javascript.snippets to see the full list.

添加新评论