

Vim-c-cr, a super simple plugin to give ctrl+enter a little magic - thatmiddleway
https://github.com/jtmkrueger/vim-c-cr

======
johncoltrane
Note that <C-CR> only works in GUI Vim because it is virtually
indistinguishable from <CR> in (most?) terminal emulators. They actually send
different signals but Vim doesn't care.

I've had many slightly dumber variations of that mapping in my ~/.vimrc for a
while, using <leader><CR> instead of <C-CR> for the reason outlined above.

 _Edit_

I borrowed you Closer() function and modified it to make it work simply on
<CR>, based on my previous mapping:

    
    
        " my previous mapping
        inoremap <leader><CR> <CR><C-o>==<C-o>O
    
        " your revised function
        function! Closer()
          let  prevchar = getline(".")[col(".")-2]
          if prevchar ==# "{"
            return "\<CR>}\<C-o>==\<C-o>O"
          elseif prevchar ==# "["
            return "\<CR>]\<C-o>==\<C-o>O"
          elseif prevchar ==# "("
            return "\<CR>)\<C-o>==\<C-o>O"
          else
            return "\<CR>"
          endif
        endfunction
    
        " your revised mapping
        inoremap <expr> <CR> Closer()

------
daturkel
This is potentially very nice for CSS. Thanks for sharing!

