Raimondi / delimitMate

Vim plugin, provides insert mode auto-completion for quotes, parens, brackets, etc.
http://www.vim.org/scripts/script.php?script_id=2754
1.98k stars 117 forks source link

Javascript Array Indentation #177

Closed siddhion closed 9 years ago

siddhion commented 10 years ago

Simple Array

When I try to create Javascript arrays no indentation happens after pressing enter. Here is what happens:

Step 1 : Create Array

var array = [|]

Step 2 : Press Enter

var array = [
|
]

As you can see the cursor position is at the 1st position in the line when it should be at the 3rd.

Array within an Array

Also if I create another array with in that array this happens:

Step 1 : Create Internal Array

var array = [
[|]
]

Step 2 : Press Enter

var array = [
[
|
]
]

Array within an Object

And if I decide to add an array to an object this is what happens:

Step 1 : Create Object

var object = {|}

Step 2 : Press Enter

var object = {
  |
}

Step 3 : Create Array

var object = {
  [|]
}

Step 4 : Press Enter

var object = {
  [
    |
    ]
}

As you can see in Step 4, the closing bracket gets indented two positions too far when it should be at the same indentation as the opening bracket.

Any ideas how to fix this array indentation issue?

siddhion commented 10 years ago

I uninstalled all of my VIM plugins besides Delimitmate and Vundle. I ran the same tests from above and still the same results. Are these results normal DelimitMate behaviours? If so, how can I control how Delimitmate handles the indentation of specific characters and indentation of the cursor after pressing Enter?

Raimondi commented 9 years ago

I can't reproduce this. I have added basic_vimrc to the repo so you can use vim -N -u basic_vimrc foo.js and try to reproduce it there. Let me know if you manage to do it.