Ⅰ. 插件描述
Next generation JavaScript and React snippets for VimⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'huangguozhen/vim-babel-snippets'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'huangguozhen/vim-babel-snippets'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'huangguozhen/vim-babel-snippets'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/huangguozhen/vim-babel-snippets
Ⅳ. 文档说明
vim-babel-snippets
Next generation JavaScript and React snippets for Vim
Require garbas/vim-snipmate
Installation
=============
Use Vundle
" vim-babel-snippets:
Bundle "huangguozhen/vim-babel-snippets"
" SnipMate and its dependencies:
Bundle "MarcWeber/vim-addon-mw-utils"
Bundle "tomtom/tlib_vim"
Bundle "garbas/vim-snipmate"
" Other sets of snippets (optional):
Bundle "honza/vim-snippets"Usage
======
In insert mode
rcc<Tab>expanding to
import React, { Component, PropType } from 'react'
export default class ClassName extends Component {
render () {
return (
)
}
}Available snippets
React
| Trigger | Content |
|---|---|
rcc→ | class component skeleton |
rccl→ | legacy component skeleton |
cdm→ | componentDidMount() {…} |
cdup→ | componentDidUpdate(prevProps, prevState) {…} |
cwm→ | componentWillMount() {…} |
cwr→ | componentWillReceiveProps(nextProps) {…} |
cwun→ | componentWillUnmount() {…} |
cwup→ | componentWillUpdate(nextProps, nextState) {…} |
fdn→ | React.findDOMNode(…) |
gdp→ | getDefaultProps() {…} |
gis→ | getInitialState() {…} |
ren→ | render() {…} |
sst→ | this.setState(…) |
scu→ | shouldComponentUpdate(nextProps, nextState) {…} |
props→ | this.props |
state→ | this.state |