How do I insert <% %>
in Vim? I have rails.vim.
It is also possible to insert erb tags in INSERT mode (using rails.vim and surround.vim plugins):
<%= %>
block<% -%>
block<%# %>
block I've been using the surround.vim plugin for a long time, but not the rails.vim plugin. Turns out that the rails.vim plugin is adding functionality to surround.vim, or is piggy-backing on it. Either way, I got it working this-a way:
eruby
filetype.:set filetype=eruby
Return to make Vim see things your way.<%= %>
or <%- %>
block.I just confirmed this works in column-selection mode too.
This is documented in the rails.vim help: from the command-mode search for :h rails-surround
. And if you don't have the help available for rails.vim, it's because the instructions weren't followed for installing it:
:helptags ~/.vim/doc
The rails.vim plugin requires the surround.vim plugin also, so that has to be previously installed. I use that plugin's functionality at least once a minute when I'm editing. It rocks.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With