mxw / vim-jsx

React JSX syntax highlighting and indenting for vim.
1.59k stars 95 forks source link

my JSX indentation is not working inside js files #144

Closed pavannaga closed 7 years ago

pavannaga commented 7 years ago

My vimrc

set nocompatible              " be iMproved, required
filetype off                  " required
syntax on
"colorscheme neuromancer
"colorscheme github
colorscheme monokai

"set background=light " for the light version

"" Set the numbers on the file as default
set number
" set t_ti=""
set backspace=indent,eol,start
"" Indent with 4 spaces (Javascript styling)
"set tabstop=4 softtabstop=0 expandtab shiftwidth=2 smarttab
"" NERDTree plugin commands
map <F2> :NERDTreeToggle<CR>
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
"" show hidden files in nerdtree
let NERDTreeShowHidden=1
let g:jsx_ext_required = 0 " Allow JSX in normal JS files
let g:xml_syntax_folding = 1 " XML folding enabled
let g:airline_theme='dark'
" syntastic settings
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*

let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
let g:syntastic_javascript_checkers = ['eslint']
let g:syntastic_python_checkers = ['pylint']
let g:jsdoc_additional_descriptions = 1
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
" Add spaces after comment delimiters by default
let g:NERDSpaceDelims = 1

" Use compact syntax for prettified multi-line comments
let g:NERDCompactSexyComs = 1

" Align line-wise comment delimiters flush left instead of following code indentation
let g:NERDDefaultAlign = 'left'

" Set a language to use its alternate delimiters by default
let g:NERDAltDelims_java = 1

" Add your own custom formats or override the defaults
let g:NERDCustomDelimiters = { 'c': { 'left': '/**','right': '*/' } }

" Allow commenting and inverting empty lines (useful when commenting a region)
let g:NERDCommentEmptyLines = 1

" Enable trimming of trailing whitespace when uncommenting
let g:NERDTrimTrailingWhitespace = 1

" Enable nerdtree to open files in new tab
let NERDTreeMapOpenInTab='\r'

" enbale tabline
let g:airline#extensions#tabline#enabled = 1
" For devicons
set guifont=<FONT_NAME>:h<FONT_SIZE>
set guifont=Droid\ Sans\ Mono\ for\ Powerline\ Plus\ Nerd\ File\ Types:h11
let g:airline_powerline_fonts = 1
" Auto close html tags
let g:closetag_filenames = "*.html,*.xhtml,*.phtml,*.js,*.jsx"
" noremap <F3> :Autoformat<CR>
"au BufWrite * :Autoformat
autocmd FileType javascript noremap <buffer>  <c-f> :call JsxBeautify()<cr>
autocmd FileType javascript vnoremap <buffer> <c-e> :call RangeEsBeautifier()<cr>
" for json
autocmd FileType json noremap <buffer> <c-f> :call JsonBeautify()<cr>
" " for jsx
autocmd FileType jsx noremap <buffer> <c-f> :call JsxBeautify()<cr>
" " for html
autocmd FileType html noremap <buffer> <c-f> :call HtmlBeautify()<cr>
" " for css or scss
autocmd FileType css noremap <buffer> <c-f> :call CSSBeautify()<cr>
" jedi-vim settings
" for devicons
let g:webdevicons_enable_airline_tabline = 1
let g:webdevicons_enable_airline_statusline = 1
let g:webdevicons_enable_ctrlp = 1
let g:WebDevIconsNerdTreeGitPluginForceVAlign = 1

call vundle#begin()
"" Plugins -----
Plugin 'VundleVim/Vundle.vim'
Plugin 'tpope/vim-fugitive'
"Plugin 'git://git.wincent.com/command-t.git'
Plugin 'ascenator/L9', {'name': 'newL9'}
Plugin 'scrooloose/nerdtree'
Plugin 'mxw/vim-jsx'
Plugin 'pangloss/vim-javascript'
"" Js beautifier
"Plugin 'dai-shi/es-beautifier'
Plugin 'maksimr/vim-jsbeautify'
Plugin 'heavenshell/vim-jsdoc'
Plugin 'plasticboy/vim-markdown'
Plugin 'elzr/vim-json'
Plugin 'jiangmiao/auto-pairs'
Plugin 'scrooloose/nerdcommenter'
Plugin 'alvan/vim-closetag'
Plugin 'valloric/youcompleteme'
Plugin 'powerline/powerline'
" Python plugins
Plugin 'davidhalter/jedi-vim'
Plugin 'scrooloose/syntastic'
Plugin 'heavenshell/vim-pydocstring'
" ruby plugins
Plugin 'vim-ruby/vim-ruby'
Plugin 'tpope/vim-endwise'
" rake file
Plugin 'tpope/vim-rake'
" vim yaml
Plugin 'pearofducks/ansible-vim'
" docker
Plugin 'ekalinin/dockerfile.vim'
" Spell check for README
Plugin 'reedes/vim-lexical'
Plugin 'ctrlpvim/ctrlp.vim'
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
Plugin 'ryanoasis/vim-devicons'
" colorschemes
Plugin 'tomasr/molokai'
Plugin 'rakr/vim-one'
Plugin 'altercation/vim-colors-solarized'
Plugin 'editorconfig/editorconfig-vim'
" All of your Plugins must be added before the following line
call vundle#end()            " required
filetype plugin indent on    " require
niawdeleon commented 7 years ago

Have you tried disabling the other plugins to see if there's a conflict? Also, what do you see when you do :scriptnames on a .js file?

mxw commented 7 years ago

Read README please.