On 4/21/06, Nikolai Weibull <[EMAIL PROTECTED]> wrote:
> Still, I figured that now that we have operator functions ...
> I would be able to define my long-wanted "g:"
> mapping that makes : act like an operator, i.e., first waits for a
> range and then starts command mode with that range on the command
> line:
>
> noremap <silent> g: <Esc>:set operatorfunc=GetCommandModeRange<CR>g@
>
> function! GetCommandModeRange(type)
>   let b = line("'[")
>   let e = line("']")
>
>   if b < e
>     let range = '.,+' . (e - b)
>   elseif b == e
>     let range = '.'
>   else
>     let range = '.,+' . (b - e)
>   endif
>
>   " start command mode with 'range' already on the command line
>   ...
> endfunction
>
> The question is, how do I start command mode?

Does this work for you inside the function :
    :exe "normal :".range
?

Yakov

Reply via email to