On Thu, 20 Apr 2006 21:19:29 -0400 sean <[EMAIL PROTECTED]> wrote: > On Fri, 21 Apr 2006 01:41:46 +0200 > "Nikolai Weibull" <[EMAIL PROTECTED]> wrote: > > > Still, I figured that now that we have operator functions and > > expression mappings (that don't seem to be able to do anything that > > <C-R>=... couldn't do) 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: > > Why isn't <define range> : good enough? Just trying to understand > why typing the colon before the range is important to you. > > > The question is, how do I start command mode? It's just not possible. > > It seems that we lack a function to just send a set of keystrokes to > > Vim and Vim will take the appropriate action. > > The problem isn't starting command mode, it's leaving it active when your > script function terminates. AFAIK there is just no way for a vim function > to return control to the user with a partially completed (or even empty) > cmd-mode prompt. >
Note that to a certain extent you can fake it... 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 exe input(":", range) endfunction Sean