Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

indentation issue #1255

Open
Sec42 opened this issue Apr 29, 2024 · 0 comments
Open

indentation issue #1255

Sec42 opened this issue Apr 29, 2024 · 0 comments

Comments

@Sec42
Copy link

Sec42 commented Apr 29, 2024

I have stumbled upon the following issue with the javascript
indentation:

Let's assume that I have the following function with inconsistent indenting:

function hello(loc){
    console.log("hello",loc);
    if (loc == "world"){
      console.log("the whole world");
    }
    return true;
}

Now if I move the cursor to the "the whole world" line and press o to open a
new line, the cursor sits at column 9, not at column 7 where the
previous line started.

I have found that this seems to be, because at that point I had
shiftwidth set to 4.

The issue is, I'm editing code (written by someone else) that has
inconsistent indentation, so if I set "sw" to "2", it just breaks the
same way in other locations (this time for example with first
console.log line)

Is there a way to fix it so it honors the indentation of the current
block by default much like the builtin "C" indenting that vim has?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant