here is an example of code inside of my .js file after gg=G command:
JavaScript
x
11
11
1
class ChannelSection extends React.Component{
2
render(){
3
return(
4
<div>
5
<ChannelList channels={channels} />
6
<ChannelForm />
7
</div>
8
)
9
}
10
}
11
As you can see html tags have the same indent. I wish it would be like in html files – nested blocks indented further. Some plugin that can help?
Again, I need to indent ONLY HTML tags in .js file, not in .html file.
Advertisement
Answer
You may use mxw/vim-jsx. This plugin requires pangloss/vim-javascript, so you should install both of them.
This is a minimal .vimrc
I used with vim-plug:
JavaScript
1
10
10
1
set nocompatible
2
filetype off
3
4
call plug#begin()
5
Plug 'pangloss/vim-javascript'
6
Plug 'mxw/vim-jsx'
7
call plug#end()
8
9
let g:jsx_ext_required = 0
10
Note that I set g:jsx_ext_required
to 0
because you want to edit JSX tags in .js
files.