2072 / PHP-Indenting-for-VIm

The official VIm indent script for PHP
http://www.2072productions.com/to/phpindent.txt
128 stars 29 forks source link

Parenthesis and brackets not indent correctly when delimitMate plugin installed #35

Closed swekaj closed 10 years ago

swekaj commented 10 years ago

This issue is when Raimondi/delimitMate is installed and the delimitMate_expand_cr option is enabled.

If you type [<cr> or (<cr>, the expected behavior is:

$arr = array(
    |
)

where | is the cursor position. Instead, what happens is:

$arr = array(
    |
    )

Notice the closing ) is indented one level farther than it should be. The same behavior happens with [ ].

I'm not sure if this is an issue with the indenting script, or DelimitMate. I guessed the indenting since { } pairs work fine, but if I was wrong I can open issue there instead.

2072 commented 10 years ago

What is the value of the indentkeys option? Note that 0] is missing in the current version of the indent script but it should work for ).

Try :set indentkeys=0{,0},0),0],:,!^F,o,O,e,*<Return>,=?>,=<?,=*/

If the ) or ] is indented correctly when you use <C-F> on the line or == in normal mode it means that the problem is caused by delimitMate which doesn't trigger the call to indentexpr when it auto-inserts ) or ]

swekaj commented 10 years ago

Ah, ok. So the problem is with delimitMate, then, as the ) and ] indent correctly when I use <C-F>, ==, or one of the other characters normally in &indentkeys (e.g. a ,).

I'll open issue there, then. Thanks for your help.