How can I insert empty ERB tags and put cursor inside it? It is similar to surrounding with surround plugin, but there is nothing to surround.
For example, from this:
bla|bla
I want get this:
bla<%= | %>bla
I would use Tim Pope's surround plugin to accomplish this.
Add the following to you ~/.vim/after/ftplugin/erb.vim
let b:surround_{char2nr('=')} = "<%= \r %>"
let b:surround_{char2nr('-')} = "<% \r %>"
Now when you press <c-s>=
it will insert <%= | %>
just as you wanted.
You may also want to look at Tim Pope's ragtag plugin which has such mappings already included.