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

Fix expand_cr behavior with 'smartindent' #180

Closed lilyball closed 9 years ago

lilyball commented 10 years ago

When indentation is controlled by 'smartindent', the expand_cr behavior doesn't end up producing the same results that you would get without delimitMate. The following behavior results instead:

Before: {|}
After: {
        |
    }

The expected behavior is to produce the following:

Before: {|}
After: {
    |
}

To that end, detect when indentation is controlled by 'smartindent' and adjust the indentation of the close line to match.

blueyed commented 10 years ago

JFI: I have run the test suite with this patch applied and it does not cause any (additional failures).

It would be nice to have a test for this fix / with this PR! (I have just created a PR / Makefile, which makes running the tests easy: https://github.com/Raimondi/delimitMate/pull/183).

lilyball commented 10 years ago

I'm not familiar with how to handle the tests, and I am not particularly inclined to install runVimTests and VimTAP unless absolutely necessary.

blueyed commented 10 years ago

No problem.

(although "installing runVimTests" would get done automatically from "make test").

Currently the delimitMate repo appears to be unmaintained anyway?!

hjpbarcelos commented 10 years ago

Javascript behaviour:

Before: 
var obj = {|}
After:    
var obj = {
|}

Expected:

var obj = {
    |
}
// or

var obj = {
    |}
// after another line-break:

var obj = {

|}
mplorentz commented 10 years ago

+1 for this.

blueyed commented 10 years ago

@mplorentz Have you tried the PR / patch? Would you like to add a test case for / to it?

FWIW: using hub is a great way to checkout pull requests etc.

Besides this, the repository appears to be unmaintained: https://github.com/Raimondi/delimitMate/issues/191

mplorentz commented 10 years ago

My issue was actually with how smartindent handles python files and not with the DelimitMate plugin. Sorry.

marlun commented 10 years ago

@blueyed I'm having the same problem and I manually added the changes from your PR but it did not seem to help?

blueyed commented 10 years ago

@marlun It's not my PR and I am not using it myself. I am using my fork, which is not that different: https://github.com/blueyed/delimitMate/compare/Raimondi:38487bb...blueyed:877e3ee

So, if you're using my fork then you won't have this fix.

Raimondi commented 9 years ago

Thanks!