I've tried the following, but it doesn't work.
inoremap <C-\> <Esc>$a<Space>do<Space><Bar><Bar><CR>end<Esc>k$i
I'm trying to map a shortcut for ruby do || .. end
blocks.
If I understood your question correctly, you want to insert some boilerplate code. There are several ways to approach this:
:help q
), which you can later replay (:help @
). This sequence is recorded in the register, which is not the same as mapping/macro, but achieves your goal still, plus it can be made persistent (i.e. survive ViM restarts).:inoremap <C-\> <Esc>A<Space>do<Space><Bar><Bar><CR>end<Esc>ko
Hope this helps.
||
insertion works, here.