GithubHelp home page GithubHelp logo

isabella232 / vim-jsx-pretty Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lumakernel/vim-jsx-pretty

0.0 0.0 0.0 172 KB

https://github.com/LumaKernel/vim-jsx-pretty/issues/1

License: MIT License

Vim Script 100.00%

vim-jsx-pretty's Introduction

vim-jsx-pretty

The React syntax highlighting and indenting plugin for vim. Also supports the typescript tsx file.

Features

  • ๐Ÿ“ฆ Support JSX highlighting and indenting out of the box. No dependencies.
  • ๐Ÿ’ฏ Fully implemented the JSX syntax specification. https://github.com/facebook/jsx
  • โœจ Support React syntax highlighting and indenting for JSX and typescript TSX files.
  • ๐Ÿท Support JSX syntax highlighting and indenting inside the tagged template string.
  • ๐ŸŽจ Support highlighting the close tag separately from the open tag (set let g:vim_jsx_pretty_highlight_close_tag = 1 in your vimrc).
  • ๐Ÿ’ช Many more corner test cases covered.
  • ๐Ÿ’… Reasonable syntax highlight groups, easy for customization.

Demo

Syntax

vim-jsx-pretty
(add colorful config)
vim-jsx-pretty
vim-jsx-pretty colorful vim-jsx-pretty

Auto indent

Auto indent demo

Support typescript

typescript demo

Installation

vim-plug https://github.com/junegunn/vim-plug

your ~/.vimrc:

  • No dependencies

    Plug 'maxmellon/vim-jsx-pretty'
  • with: yuezk/vim-js (Recommended but not required)

    Plug 'yuezk/vim-js'
    Plug 'maxmellon/vim-jsx-pretty'
  • if you want to highlight tsx files.

    Plug 'HerringtonDarkholme/yats.vim'
    " or Plug 'leafgarland/typescript-vim'
    Plug 'maxmellon/vim-jsx-pretty'
  • Execute command in vim:

    :so ~/.vimrc
    :PlugInstall

โš ๏ธ Work with vim-polyglot

Since vim-polyglot has already embedded this plugin, if you have installed vim-polyglot, you don't need to install this plugin anymore. But the bugfix for this plugin may not ship in vim-polyglot in time.

If you still want to use this plugin, make sure that you put this plugin ahead of vim-polyglot, and add let g:polyglot_disabled = ['jsx'] to your vimrc.

Syntax group list

name place
jsxElement <tag id="sample">text</tag>
~~~~~~~~~~~~~~~~~~~~~~~~~~~
jsxTag <tag id="sample">
~~~~~~~~~~~~~~~~~
jsxTagName <tag id="sample">
_~~~_____________
jsxComponentName <Capitals>
_~~~~~~~~_
jsxAttrib <tag id="sample">
_____~~__________
jsxEqual <tag id="sample">
_______~_________
jsxString <tag id="sample">
________~~~~~~~~_
jsxCloseTag </tag>
~~~~~~
jsxCloseString <tag />
_____~~
jsxDot <Parent.Child>
_______~______
jsxNamespace <foo:bar>
____~____
jsxPunct <tag></tag>
~___~~~___~

Configuration

name default description
g:vim_jsx_pretty_disable_tsx 0 Disable the syntax highlighting for tsx files
g:vim_jsx_pretty_template_tags ['html', 'jsx'] highlight JSX inside the tagged template string, set it to [] to disable this feature
g:vim_jsx_pretty_highlight_close_tag 0 highlight the close tag separately from the open tag
g:vim_jsx_pretty_colorful_config 0 colorful config flag

Colorful style (vim-javascript only)

let g:vim_jsx_pretty_colorful_config = 1 " default 0

Inspiration

LICENSE

MIT

vim-jsx-pretty's People

Contributors

cormacrelf avatar lumakernel avatar maxmellon avatar qstrahl avatar rbong avatar tsuyoshicho avatar tyru avatar y0za avatar yuezk avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.