Ⅰ. 插件描述
The snippets for weex in vimⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'vim-weex/vim-weex-snippets'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'vim-weex/vim-weex-snippets'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'vim-weex/vim-weex-snippets'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/vim-weex/vim-weex-snippets
Ⅳ. 文档说明
vim-weex-snippets
A set of snippets for Vim to work with Alibaba's Weex library.
Requires vim-snipmate or Ultisnips.
Installation
Use your preferred Vim plugin installation method.
I like Vundle, but other options like
pathogen should work fine as well.
SnipMate
If you're using Vundle, and you don't currently have SnipMate, you will need to
add the following to your .vimrc (taken from the SnipMate README):
" vim-weex-snippets:
Bundle "vim-weex/vim-weex-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"Ultisnips
If you prefer to use vim-weex-snippets with Ultisnips, put this in your .vimrc
to install using Vundle
" vim-weex-snippets:
Bundle "vim-weex/vim-weex-snippets"
" Ultisnips
Bundle "SirVer/ultisnips"
" Other sets of snippets (optional):
Bundle "honza/vim-snippets"Usage
Within any Javascript or Weex file, you should be able to do the following:
(in insert mode)
weex<Tab>expanding to
<template>
_
</template>
<script>
var modal = require('@weex-module/modal');
var stream = require('@weex-module/stream');
var animation = require('@weex-module/animation');
var dom = require('@weex-module/dom');
module.exports = {
data: {},
init: function () {},
created: function () {},
ready: function () {},
methods: function () {}
}
</script>
<style>
/* Add style to here */
</style>And a bunch of others!
Check snippets/javascript.snippets to see the full list.