Thanks for following along here, and I hope this package was useful to folks in the years since React first debuted.
If things change and this package becomes actively maintained again, I'll be sure to update this note.
Vim support for inline XML in JS is remarkably similar to the same for PHP, which you can find here.
If you're experiencing incorrect highlighting or indenting in your JSX code, please file a GitHub issue which includes the following:
A brief affirmation that you've read the README and have installed one of the supported dependencies (and the name of the one you're using).
A minimal ~/.vimrc which repros the issue you're having, as well as both a paste and a screenshot of the issue (a paste alone is insufficient, since it doesn't illustrate the specific highlighting or indenting problem). To obtain a minimal ~/.vimrc, simply bisect your ~/.vimrc by adding
finishat various points in the file. (You can likewise bisect your included plugins by selectively including only half of them, then a quarter, etc.).
(Please feel free to disregard all this for feature requests.)
By default, JSX syntax highlighting and indenting will be enabled for
files with the
.jsx extension. If you would like JSX only in
.jsx files, add
let g:jsx_ext_required = 1
to your .vimrc or somewhere in your include path. If you wish to restrict JSX
to files with the pre-v0.12
@jsx React.DOM pragma, add
let g:jsx_pragma_required = 1
to your .vimrc or somewhere in your include path.
Frequently Asked Questions
- How come syntax highlighting doesn't work at all?
This is the only question I'll answer with another question---Which do you think is more likely: (a) this package fails completely and utterly in serving its most fundamental purpose, or (b) user error?
- Why are my end tags colored differently than my start tags?
- Syntax highlighting seems to work, but breaks highlighting and indenting further down in the file. What's wrong?
This often results from trying to enable XML folding in one's
let g:xml_syntax_folding = 1). vim-jsx does not support syntax folding,
The recommended installation method is via Pathogen. Then simply execute
git clone https://github.com/mxw/vim-jsx.git ~/.vim/bundle/vim-jsx
You can also add vim-jsx using Vundle---just add the following lines to
To install from within vim, use the commands below.
:so ~/.vimrc :PluginInstall
Alternatively, use the command below to install the plugins from the command line.
vim +PluginInstall +qall
If you have no
~/.vim/after directory, you can download the tarball or zip
and copy the contents to
If you have existing
~/.vim/after files, copy the syntax and indent files
directly into their respective destinations. If you have existing after syntax