:iabbrev CUC <NL>cucumber
:inoremap <C-y> CUC<space>

But when I press Ctrl-y I get 'CUC ' i.e. the CUC does not get
expanded. I tried

:inoremap <C-y> CUC<Esc>

and

:inoremap <C-y> CUC<C-]>

but no dice. Then I tried

:inoremap <C-y> CUC<ESC>B"gd$a<C-r>=maparg(@g , "i" , 1)<CR>

which does expand the abbreviation but it gives the 4 characters
in "<NL>" instead of an actual newline (plus it overwrites the
g register). Then I tried

:inoremap <C-y> CUC<ESC>B"gd$a<C-r>=substitute(maparg(@g , "i" , 1) ,
'<' . 'NL>' , "\n" , "")<CR>

which finally works. Note the    '<' . 'NL>'    instead of '<NL>'
so that we don't get an actual newline in the mapping.

Is there a more straightforward solution ?

-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Reply via email to