开发者

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

开发者 https://www.devze.com 2023-04-11 22:39 出处:网络
This question already has answers here开发者_开发知识库: Closed 11 years ago. Possible 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

精彩评论

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