vim-autoclose icon indicating copy to clipboard operation
vim-autoclose copied to clipboard

Auto-close with line breaks

Open thewinger opened this issue 8 years ago • 4 comments

Is there a way of entering a line break whan auto-closing?

Specially in CSS, when I write

.foo {

I get

.foo {|}

Is there a way of getting?

.foo {
    |
}

thewinger avatar Dec 01 '16 09:12 thewinger

I just mapped {<CR> to do something like this (<CR> is enter):

inoremap {<CR> {<CR>}<Esc>O

This way, you can also just make an inline block by not hitting enter after the bracket.

ollpu avatar Jan 07 '17 16:01 ollpu

@ollpu Thanks, I'll try that

thewinger avatar Jan 09 '17 09:01 thewinger

@thewinger I added better support for matching character pairs with line breaks. You can find the updated version here: https://github.com/whitehatzero/vim-autoclose

Since I essentially just handled the insert mode remap like @ollpu suggested, you might need to remove that particular key mapping from your vimrc if you run into any weird behavior.

ghost avatar Dec 20 '18 06:12 ghost

@whitehatzero great! Thanks!

thewinger avatar Dec 20 '18 06:12 thewinger