My config files
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
Buddy Sandidge b0e35109dd Squashed 'vim/bundle/jsx/' changes from c6d0fd7d4..d0ad98cf0
d0ad98cf0 Merge pull request #92 from jambonrose/update-vundle-readme
005c0f6e3 Expand Vundle section in ReadMe.
2bd9126d7 Merge pull request #89 from StoicLoofah/manual-installation-path
3233f48ae update README to provide correct filenames for manual installation
b25141d22 Add a syntax element for JSX child blocks
34b6b9994 Merge pull request #75 from ksmithbaylor/patch-1
6d32ac410 Clarify regex comment
2e3292c0e Combine multiline opening tag logic
dfa485d5b Remove g:jsx_multiline_opening_tags flag
14a820c5c Add support for multiline opening tags
db329e121 Add rules and regulations for filing issues...
af0831cc0 Cleanup
c68282f41 Merge pull request #11 from jstoja/vundle-install
80dbab758 Avoid conflict w/ Flow generics
da9b92b72 Move ftdetect out of after/
fc200a394 Remove legacy jsx-config stuff
9c9a13165 Source formating changes
6d4698f86 Adding the vundle installation line into the README

git-subtree-dir: vim/bundle/jsx
git-subtree-split: d0ad98cf0e5a01abd5008c0e97775500b88b0bc1
9 years ago
after Squashed 'vim/bundle/jsx/' changes from c6d0fd7d4..d0ad98cf0 9 years ago
ftdetect Squashed 'vim/bundle/jsx/' changes from c6d0fd7d4..d0ad98cf0 9 years ago
README.md Squashed 'vim/bundle/jsx/' changes from c6d0fd7d4..d0ad98cf0 9 years ago

README.md

vim-jsx

Syntax highlighting and indenting for JSX. JSX is a JavaScript syntax transformer which translates inline XML document fragments into JavaScript objects. It was developed by Facebook alongside React.

This bundle requires pangloss's vim-javascript syntax highlighting.

Vim support for inline XML in JS is remarkably similar to the same for PHP, which you can find here.

Troubleshooting

If you're experiencing weird highlighting or indenting throughout your JSX code, please file a GitHub issue which includes the following:

  • A brief affirmation that you've read the README and installed the appropriate dependencies.

  • A minimal ~/.vimrc which repros the issue you're having, as well as a screenshot or gif of the issue (a paste is insufficient, since it doesn't show me the specific highlighting or indenting problem). To obtain a minimal ~/.vimrc, simply bisect your ~/.vimrc by adding finish at various points in the file. (You can likewise bisect your included plugins by selectively including only half of them, then a quarter, etc.).

Most of the issues filed result from failures to install vim-javascript or conflicts with existing JS syntax or indent files---so failing to indicate that you've ruled those issues out may result in your issue being closed with no comment.

(Please feel free to disregard all this for feature requests and more corner-case bugs.)

Usage

By default, JSX syntax highlighting and indenting will be enabled only for files with the .jsx extension. If you would like JSX in .js files, add

let g:jsx_ext_required = 0

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.

Please note that this package does not support syntax folding, and has not been tested with either JavaScript or XML folding enabled.

Installation

Pathogen

The recommended installation method is via Pathogen. Then simply execute

cd ~/.vim/bundle
git clone https://github.com/mxw/vim-jsx.git

(You can install vim-javascript in an analogous manner.)

Vundle

You can also add vim-jsx using Vundle---just add the following lines to your ~/.vimrc:

Plugin 'pangloss/vim-javascript'
Plugin 'mxw/vim-jsx'

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

Manual Installation

If you have no ~/.vim/after directory, you can download the tarball or zip and copy the contents to ~/.vim.

If you have existing ~/.vim/after files, copy the syntax and indent files directly into their respective destinations. If you have existing after syntax or indent files for Javascript, you'll probably want to do something like

mkdir -p ~/.vim/after/syntax/javascript
cp path/to/vim-jsx/after/syntax/jsx.vim ~/.vim/after/syntax/javascript/jsx.vim
mkdir -p ~/.vim/after/indent/javascript
cp path/to/vim-jsx/after/indent/jsx.vim ~/.vim/after/indent/javascript/jsx.vim