开发者

How can I automatically create a new line when editing CSS in vim? (like textmate) [duplicate]

This question already has answers here开发者_开发知识库: Closed 11 years ago.

Possible Duplicate:

Make Vim Curly Braces, Square Braces, Parens act like Textmate

I'm coming from textmate and I'm really really loving vim.

One part I liked about textmate was when editing css you would type

.title {

and it would auto complete the brackets to this (where | is the cursor)...

.title {|}

THen you would hit enter and it turns to

.title {
    |
}   

I have the "Autoclose" plugin but when you hit enter it just brings the } with it and looks like a mess.


You can try an imap:

:imap { {<Esc>o}<Esc>ko


There is a nice Vim plugin, snipMate, that provides auto-completion and maybe can attend your needs.

By default it works for bigger patterns, as the entire tag .title in your example. Maybe you could insert a snippet for '{'.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜