Ⅰ. 插件描述
Plugin with some utilities (like extract partial render, rename tag, select self close tags) to folks who work with JSX on Vim.Ⅱ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'samuelsimoes/vim-jsx-utils'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'samuelsimoes/vim-jsx-utils'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'samuelsimoes/vim-jsx-utils'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/samuelsimoes/vim-jsx-utils
Ⅳ. 文档说明
# vim-jsx-utils
Plugin with some utilities to folks who work with JSX on Vim.
:warning: This plugin only expose a set of functions. You need create your own mappings to this, like:
nnoremap <leader>ja :call JSXEncloseReturn()<CR>
nnoremap <leader>ji :call JSXEachAttributeInLine()<CR>
nnoremap <leader>je :call JSXExtractPartialPrompt()<CR>
nnoremap <leader>jc :call JSXChangeTagPrompt()<CR>
nnoremap vat :call JSXSelectTag()<CR>:warning: All functions must be invoked on the first component line.
Installation
You can install this plugin with Pathogen, Vundle and other plugin loaders.
Functions
JSXSelectTag
Select the whole tag, like vat, but with a little improvement to select self-closing tags.
JSXEncloseReturn
Put the current tag on a return statement with parenthesis.

JSXEachAttributeInLine
Put each tag attribute's on its own line to better readability.

JSXExtractPartialPrompt
:warning: Only ES6 classes
Extract some tag on its own method on a ES6 class.

JSXChangeTagPrompt
Change the tag name

Samuel Simões ~ @samuelsimoes ~ Blog