On Sep 11, 8:42 am, ZyX <zyx....@gmail.com> wrote:
> Reply to message "Abbreviations and key mappings",
> sent 10:16:13 11 September 2011, Sunday
> by Spiros Bousbouras:
>
> > :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
>
> Why can't you directly use
>     inoremap <C-y> <Nl>cucumber<Esc>
> instead?

I presented a simplified version of what I want. I actually have
several abbreviations and I want <C-y> to work with all of them.
For example

:iabbrev CUC <NL>cucumber
:iabbrev TOM <NL>tomato

CUC<C-y>
where '<C-y>' means pressing Ctrl-y , must insert a newline and
then 'cucumber'.
TOM<C-y> must insert a newline and then 'tomato'. And so forth for
all the other abbreviations. So my best effort so far is

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

It is possible that my abbreviations will contain other special
characters beside <NL> so I'd rather not have to substitute for
each case.

-- 
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