Coder Social home page Coder Social logo

auto-indentation broken about vim-jsx HOT 15 CLOSED

mxw avatar mxw commented on June 8, 2024
auto-indentation broken

from vim-jsx.

Comments (15)

mxw avatar mxw commented on June 8, 2024

It doesn't look like the syntax highlighting is on for you either. Did you follow all the installation instructions? If you're using the default settings, did you make sure to use the .jsx extension for your filename?

from vim-jsx.

seadb avatar seadb commented on June 8, 2024

The file is named react.jsx and my status bar tells me that "javascript.jsx" is being used.

The syntax highlighting may look weird because I'm running vim on a virtual machine that I'm ssh-ed into. I'm also using ConEmu on top of that.

I'm using pathogen, so I just cloned the repo into my ~/.vim/bundle folder. Is there something additional I need to do?

from vim-jsx.

mxw avatar mxw commented on June 8, 2024

Unless your VM -> emulator workflow gives you fewer than the standard eight terminal colors, you should at least have some amount of highlighting for the JSX components. It's possible the default XML syntax highlighting on your machine is not good?

There are a number of other things besides just cloning into ~/.vim/bundle that you need to doโ€”e.g., set up pathogen, do syntax enable, etc., but if you see "javascript.jsx" as the language, you probably did those things correctly.

If you send me gists or pastes or other links to your code and your ~/.vimrc, I'll have a look when I get a chance.

from vim-jsx.

seadb avatar seadb commented on June 8, 2024

I installed the vim-javascript highlighting which fixed it.
I appreciate the help!
https://github.com/pangloss/vim-javascript

from vim-jsx.

mxw avatar mxw commented on June 8, 2024

_> Please read the README fully next time :]

from vim-jsx.

seadb avatar seadb commented on June 8, 2024

It might be helpful to include the dependencies in the installation instructions. A lot of people just skip ahead to that.

from vim-jsx.

jjhuff avatar jjhuff commented on June 8, 2024

Actually, I think that this was a bug at some point in vim-javascript. I followed the install instructions a month ago and had this problem. Today, I just pulled the latest head for both vim-jsx and vim-javascript and it's fixed.

from vim-jsx.

seadb avatar seadb commented on June 8, 2024

Yeah I thought I already had vim-javascript installed. I guess when I
re-cloned it fixed the problem.
On Oct 22, 2015 5:00 PM, "Justin Huff" [email protected] wrote:

Actually, I think that this was a bug at some point in vim-javascript. I
followed the install instructions a month ago and had this problem. Today,
I just pulled the latest head for both vim-jsx and vim-javascript and it's
fixed.

โ€”
Reply to this email directly or view it on GitHub
#63 (comment).

from vim-jsx.

gma avatar gma commented on June 8, 2024

I've just installed vim-jsx and vim-javascript (with Pathogen, so have the latest version of both) on Vim 7.3 (the version that ships with Mac OS X Yosemite).

I've got broken indentation in .js files, and have let g:jsx_ext_required = 0 in my .vimrc. Removing the vim-jsx bundle and restarting Vim lead to indentation working properly again.

from vim-jsx.

mxw avatar mxw commented on June 8, 2024

Do you have a small example where the indentation breaks?

from vim-jsx.

gma avatar gma commented on June 8, 2024

Yes, this does it:

function() {                                                         
  var f = 1;                                                         

}

If I position my cursor after the semicolon on line 2 and hit enter, it ends up in column 1 on line 3.

The code then looks like this:

function() {                                                         
var f = 1;                                                         

}

I just discovered something interesting, that may or may not be useful. Line 2 was outdented when I positioned the cursor at the end of an existing line and pressed return. If I delete and then re-write line 2 without leaving insert mode and press enter, line 2 isn't outdented (but the cursor still ends up in column 1 of line 3).

from vim-jsx.

mxw avatar mxw commented on June 8, 2024

I can't repro. Can you provide the git hashes for both vim-jsx and pangloss/vim-javascript?

from vim-jsx.

gma avatar gma commented on June 8, 2024

Thanks for trying. I've got c6d0fd7 and pangloss/vim-javascript@1d8c267.

from vim-jsx.

mxw avatar mxw commented on June 8, 2024

Does the problem persist if you disable all other plugins you have in your Pathogen bundle? If soโ€”can you send me a gist of your ~/.vimrc?

from vim-jsx.

gma avatar gma commented on June 8, 2024

You were on the right lines. I found I had some old ~/.vim/indent/{html,javascript}.vim files from 2011 that must have been interfering.

Deleting them got everything working beautifully. Sorry for the spam, and cheers for the plugin!

from vim-jsx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.