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

HTML indent on closing tag #168

Closed baopham closed 10 years ago

baopham commented 10 years ago

Usually when I close a tag, Vim auto indents for me:

<html>
</html>

But when I installed delimitMate, this is what I get:

<html>
    </html>

How do I fix this?

blueyed commented 10 years ago

Normally, the re-indentation is triggered via indentkeys:

A list of keys that, when typed in Insert mode, cause reindenting of
the current line.  Only happens if 'indentexpr' isn't empty.
The format is identical to 'cinkeys', see |indentkeys-format|.
See |C-indenting| and |indent-expression|.

When delimitMate inserts the closing ">" automatically, this appears to get skipped (even when you re-type over the closing >).

blueyed commented 10 years ago

FWIW, you can close a tag using <C-x>/ with ragtag: https://github.com/tpope/vim-ragtag/blob/master/doc/ragtag.txt#L37

baopham commented 10 years ago

I see. Thanks for the explanation. I'll probably consider installing ragtag to fix this.

blueyed commented 10 years ago

@baopham I came up with a workaround for this particular case: https://github.com/blueyed/delimitMate/commit/df1f32f7729c1535415e87884c60d6010afa1334

You can also just press == to trigger indentation of the current line yourself in this situation.

Also, consider using sparkup or something similar to expand HTML markup.

baopham commented 10 years ago

@blueyed cool! I hope it will be merged soon