Comments (35)
I had this issue. Turns out it was conflicting with sheerun/vim-polyglot. Removed that plugin and everything is fine.
For anyone else having this issue, grep for javascript.vim
and see where it appears. Then selectively remove those which aren't vim-jsx, vim-javascript
from vim-jsx.
I'm unable to repro this. My best guess is that you aren't using pangloss's https://github.com/pangloss/vim-javascript syntax and indentation, which is a dependency specified in the README.
If you aren't, including that bundle should fix your issue. If you are, can you give me a list of the bundles you are using, and possibly a link or paste to your .vimrc?
from vim-jsx.
Oh, but if you aren't using vim-javascript, I would expect the syntax to break, too... hm.
from vim-jsx.
Yeah, I was definitely using vim-javascript. I've uninstalled both plugins now, but here's my .vimrc (sorry, it's a mess).
from vim-jsx.
Would you mind seeing what happens if you comment out all your plugins except for vim-javascript and vim-jsx? If indenting in a new vim session still doesn't work right, then something is very wrong—vim-jsx should definitely be indenting both JSX and regular JS correctly.
If commenting out all the other plugins fixes the issue, you can try adding back each plugin individually to see which one commits, at which point I can take a look. No guarantees though in that case—plugin conflicts are sort of just par for the course when you have a lot of plugins though (especially one like mine which tries to reach into existing language plugins and muck around with things).
from vim-jsx.
Uff, that sounds like a lot of work, and I was only using this plugin for highlighting HTML in JSX files, which I can live without. Is there any way you can make the syntax highlighting a separate plugin?
from vim-jsx.
Just the first of those (i.e., commenting out your other plugins) should be pretty quick, right? If it's still broken after that, it's probably vim-jsx's fault, and I'll give you a fix.
Also, just noticed this—I don't actually know how Vundle works, but in their README, they have filetype off
before the vundle#rc()
or vundle#begin()
invocation and list of plugins. If you move that line to the top of the file, do things get better?
If neither of these reveals the issue and it's just a plugin conflict you don't want to dig into, I don't want to split off the syntax and indentation (especially since one relies on the other)—your best be in that case is just to wipe away the after/indent
directory locally.
from vim-jsx.
I'll look into it when I have some free time and let you know. If I don't reply to this issue in a week or two, feel free to close it. :)
Thanks for your help!
from vim-jsx.
I had the same issue, and.. had missed pangloss/javascript - works fine.
from vim-jsx.
Same here, somehow pangloss/javascript had gotten commented out-- putting it back resolved this issue for me.
from vim-jsx.
@imiric—If you figure out the conflicting bundle, let me know and I can try to fix things for you. Closing for now.
from vim-jsx.
I'm having this same issue and I have pangloss/vim-javascript loaded.
from vim-jsx.
@jarodtaylor—Can you send me a paste or a gist of your ~/.vimrc?
from vim-jsx.
I'm using a dotfiles config so I am using .local on my configs. So this is just "my" vimrc.local file.
set number
set t_ti= t_te=
set ts=2
set smarttab
set nolist
set tabstop=2
set expandtab
set shiftwidth=2
set softtabstop=2
set background=dark
let g:solarized_visibility = "high"
let g:solarized_contrast = "high"
colorscheme solarized
let g:user_emmet_expandabbr_key = '<C-g>'
let g:use_zen_complete_tag = 1
let g:jsx_ext_required = 0
from vim-jsx.
@jarodtaylor—If that's your entire config, you don't have this package included...
from vim-jsx.
The reason for my woes along similar lines turned out to be a stray javascript.vim
file in my local computer's .vim/indent
folder. Removing that file did the trick for me.
It is a little surprising that a file took precedence over the plugins I had installed (using vim-plug
). I wonder if vundle
and pathogen
also yield precedence in similar ways or whether this is hard-coded within vim.
from vim-jsx.
Had this same issue and removed the /indent/javascript file to resolve this.
from vim-jsx.
If you use vim-plug, this may help: Plug 'mxw/vim-jsx', { 'do': 'rm ~/.vim/plugged/vim-jsx/after/indent/jsx.vim' }
from vim-jsx.
@xream But that will remove the indentation-aid for XML embedded in the Javascript.
from vim-jsx.
I was having the same issue, then I commented out the entire contents of ~/.vim/plugged/vim-jsx/after/indent/jsx.vim, restarted vim then autoindent was working again in my javascript (but not in the embedded html, of course). I think that's good evidence that the problem is with that file.
from vim-jsx.
...or it conflicts with some other file from some other package.
from vim-jsx.
I'm also having the same issue with the broken indent. Happy to help trace this down. I don't seem to have a stray .vim/indent folder. Am using vim-javascript.
from vim-jsx.
As a followup, I disabled all add-ons except vim-javascript
and vim-jsx
and i still have the issue. This is running on MacVim with pathogen, if that's relevant.
from vim-jsx.
In debugging further I discovered I had somehow deleted the contents of my vim-javascript
folder. Once I restored the contents of the folder, it was all good again.
from vim-jsx.
I also had a javascript.vim
file (in my ~/.vim/syntax
folder) which prevented vim-jsx
from working, but what fooled me was that I was using js
as FileType
in my .vimrc
to set 2-space tabs for javascript files, when I should have used javascript.jsx
. This is the correct line:
au FileType javascript.jsx setlocal sw=2 sts=2 et
from vim-jsx.
javascript
should be fine there. Are you sure there wasn't another intervening file that was setting up a different autocmd?
from vim-jsx.
javascript
works, too, thanks. But I wrote js
, which didn't.
from vim-jsx.
Was broken for me too, fixed by updating from d0ad98c to eb656ed. (Didn't bother to bisect.)
from vim-jsx.
I removed (respectively renamed) vim-jsx/after/indent/jsx.vim - file and got proper indentation in jsx again.
from vim-jsx.
I am having this problem as well. I'm currently using NeoVim, is that a problem? Here is my init.vim:
[deprecated]
from vim-jsx.
@ObserverZero—Do you really need everything in that config in order to repro? Could you try to trim down until you have a minimal repo ~/.vimrc
?
from vim-jsx.
Ok, I've taken out what must be irrelevant.
"-----------------------LOADING PACKAGES--------------------
source ~/.config/nvim/autoload/autoclose.vim
source ~/.config/nvim/autoload/plug.vim
source ~/.config/nvim/autoload/pathogen.vim
source ~/.config/nvim/autoload/common-functions.vim
source ~/.config/nvim/autoload/indent-object.vim
source ~/.config/nvim/autoload/type_helpers.vim
source ~/.config/nvim/autoload/kwbd.vim
source ~/.config/nvim/autoload/syntastic-conf.vim
source ~/.config/nvim/autoload/restore_view.vim
source ~/.config/nvim/bundle/vim-slime/plugin/slime.vim
"-----------------------------------------------------------
"----------SETS VIM LANGUAGE AND MINIMAL INTERFACE----------
lan en_US
set nosmd
set noru
set noshowmode
set laststatus=0
set linebreak
set fo+=t
set cmdheight=1
set ignorecase
set autoindent
set smartindent
set incsearch
set fillchars=" "
set nocompatible
set hidden
set t_Co=256
set tabstop=4
set softtabstop=4
set shiftwidth=4
set expandtab|retab
set clipboard=unnamed
execute 'highlight FoldColumn ctermbg=0'
let $NVIM_TUI_ENABLE_CURSOR_SHAPE=1
filetype plugin on
"-----------------------------------------------------------
" ------------------JS SYNTAX AND REACT NATIVE--------------
let g:jsx_ext_required = 0
set conceallevel=1
filetype plugin indent on
filetype off
"-----------------------------------------------------------
"------------------------PLUG MODULES-----------------------
call plug#begin('~/.config/nvim/plugged')
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'justinmk/vim-sneak'
Plug 'tpope/vim-surround'
Plug 'junegunn/fzf.vim'
Plug 'altercation/vim-colors-solarized'
Plug 'critiqjo/lldb.nvim'
Plug 'honza/vim-snippets'
Plug 'chrisbra/NrrwRgn'
Plug 'wellle/targets.vim'
Plug 'flazz/vim-colorschemes'
Plug 'kana/vim-textobj-user'
Plug 'pangloss/vim-javascript'
Plug 'mxw/vim-jsx'
call plug#end()
"-----------------------------------------------------------
from vim-jsx.
So your issue only repros when you have all those plugins enabled? If not, please disable them until you figure out the minimal possible ~/.vimrc
which repros.
from vim-jsx.
I've noticed that if I have let g:jsx_ext_required = 0
in my ~/.vimrc
, this issue occurs.
As soon as I comment it out, I am able to indent again.
from vim-jsx.
I used a customized version of @xream 's suggestion:
Plug 'sheerun/vim-polyglot', { 'do': 'rm ~/.vim/plugged/vim-polyglot/after/indent/javascript.vim' }
This fixed the problem. The vim-polyglot
indent file should be irrelevant enough for not having a noticeable impact.
from vim-jsx.
Related Issues (20)
- Incorrect highlight in *.js files HOT 1
- Comments inside XML tags are not colored properly HOT 2
- jsx indenting breaks when changing colorscheme HOT 1
- Support ES6 template literals HOT 2
- Wrong indentation when omitting semicolon
- jsx omni completion HOT 3
- the plugin isn't working for me HOT 2
- Highlighting with Template literals in JSX is broken with junegunn/rainbow_parentheses.vim HOT 3
- Vim - adding new syntax hl rule does not work inside method definitions in component class HOT 1
- Backticks with curly braces in JSX break highlighting HOT 8
- Recent update breaks YouCompleteMe file path completion HOT 2
- Indenting when pasting text HOT 1
- Plugin confuses non-React .js filetype with .jsx
- Break Tags Not Right HOT 3
- Syntax (or filetype) not working properly HOT 2
- Turn off indentation portion of the plugin. HOT 2
- Setting filetype to 'javascript.jsx' is not good idea HOT 4
- My jsx isn't highlighted HOT 2
- Broken auto indentation HOT 7
- JSX syntax highlighting breaks after running `:Vex` HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vim-jsx.