When using this plugin together with vim-endwise, C-style expansions don't work properly. (See issue 55.)
If the cursor starts like this:
After <ENTER>, the result is the following:
It may help to take a look at how AutoPairs worked this out. It was a bit complicated, as I recall.