Thursday, July 19, 2012

Re: insert mode map multiple spaces

On Thursday, July 19, 2012 12:41:31 PM UTC+5:30, Christian Brabandt wrote:
> On Thu, July 19, 2012 08:20, sinbad wrote:
> > with the following insert mode mapping, if i type "test<space>oe", i'll
> > get
> > double space between "test one", can i change the mapping to always have
> > atmost one <space>
> >
> > inoremap oe <space>one<space>
>
> Use an expression mapping:
>
> fu! Map(arg)
> return (col('.') == 1 || getline('.')[col('.')-2] =~ '\S' ? ' ' : '').
> a:arg. ' '
> endfu
>
> iunmap oe
> inoremap <expr> oe Map('oe')
>
> regards,
> Christian

sorry guys for not writing clearly.
but christian got me. thanks.

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

No comments:

Post a Comment