Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/samuelsimoes/vim-jsx-utils

Plugin with some utilities (like extract partial render, rename tag, select self close tags) to folks who work with JSX on Vim.
https://github.com/samuelsimoes/vim-jsx-utils

closing-tags jsx productivity vim vim-jsx-utils vim-plugin

Last synced: about 2 months ago
JSON representation

Plugin with some utilities (like extract partial render, rename tag, select self close tags) to folks who work with JSX on Vim.

Awesome Lists containing this project

README

        

# vim-jsx-utils
Plugin with some utilities to folks who work with **[JSX](https://facebook.github.io/jsx/)** on Vim.

:warning: This plugin only expose a [set of functions](#functions). You need create your own mappings to this, like:

```
nnoremap ja :call JSXEncloseReturn()
nnoremap ji :call JSXEachAttributeInLine()
nnoremap je :call JSXExtractPartialPrompt()
nnoremap jc :call JSXChangeTagPrompt()
nnoremap vat :call JSXSelectTag()
```

:warning: All functions must be invoked on the first component line.

## Installation
You can install this plugin with [Pathogen](https://github.com/tpope/vim-pathogen), [Vundle](https://github.com/VundleVim/Vundle.vim) 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.

![](examples/enclose-vim.gif)

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

![](examples/eachline-vim.gif)

### JSXExtractPartialPrompt
:warning: Only ES6 classes

Extract some tag on its own method on a ES6 class.

![](examples/partial-vim.gif)

### JSXChangeTagPrompt

Change the tag name

![](examples/change-vim.gif)

-------
Samuel Simões ~ [@samuelsimoes](https://twitter.com/samuelsimoes) ~ [Blog](http://blog.samuelsimoes.com/)