Status of * as a command-line range

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Status of * as a command-line range

JohannS-2
I recently decided to refresh my memory on the usage for * as an ex
command-line range.  As I recall it is normally an alias for the
visually selected line range, so, for example, the following commands
are equivalent:
  :'<,'>s#pat#sub#g
  :*s#pat#sub#g
I recall, though, it has a different meaning, I think, when the the
+visual feature is disabled for build of vim.  I wanted to remind myself
of the specifics but I see that * as a range is no longer mentioned at
all in the help files.  It does still work properly though.  Is it
deprecated and scheduled for removal or just obscure?

I do not use * as an alias for '<,'> that often, mostly because if I
visually select a range of lines and press ":", Vim will intialize my ex
command as
  :'<,'>
This makes it easier to use the long form and means that any commands I
typed manually using :* as a range instead will not be as easily
accessible using the command history.  I do sometimes use :* when I want
to prime a particular command in the command history but want to use
several ex comands on visual ranges, which would push this particular
command to the back of the command history.  This way I can press
":*<up>" when I want to use that particular command and find it quickly.
Reply | Threaded
Open this post in threaded view
|

Re: Status of * as a command-line range

Tim Chase-2
 > I recently decided to refresh my memory on the usage for *
 > as an ex command-line range.  As I recall it is normally
 > an alias for the visually selected line range, so, for
 > example, the following commands are equivalent:
 >   :'<,'>s#pat#sub#g
 >   :*s#pat#sub#g
 > I recall, though, it has a different meaning, I think,
 > when the the +visual feature is disabled for build of vim.
 > I wanted to remind myself of the specifics but I see that
 > * as a range is no longer mentioned at all in the help
 > files.  It does still work properly though.  Is it
 > deprecated and scheduled for removal or just obscure?

just obscure :)

Its behavior changes depending on your 'cpoptions' (whether
it contains an asterisk in it or not).

        :help 'cpo'

and then scan down to the bottom of the list where it
details the asterisk.  I'm not sure where I found it
originally, but it's been handy on quite a regular basis.
When I mention it on the list, I get replies back of "neat!
where is that in the help?" :)

-tim












Reply | Threaded
Open this post in threaded view
|

Re: Status of * as a command-line range

Jürgen Krämer
In reply to this post by JohannS-2

Hi,

[hidden email] wrote:

> I recently decided to refresh my memory on the usage for * as an ex
> command-line range.  As I recall it is normally an alias for the
> visually selected line range, so, for example, the following commands
> are equivalent:
>   :'<,'>s#pat#sub#g
>   :*s#pat#sub#g
> I recall, though, it has a different meaning, I think, when the the
> +visual feature is disabled for build of vim.  I wanted to remind myself
> of the specifics but I see that * as a range is no longer mentioned at
> all in the help files.

you have to ask for

  :help :star

Regards,
J?rgen

--
J?rgen Kr?mer                              Softwareentwicklung
HABEL GmbH & Co. KG                        mailto:[hidden email]
Hinteres ?schle 2                          Tel: +49 / 74 61 / 93 53 - 15
78604 Rietheim-Weilheim                    Fax: +49 / 74 61 / 93 53 - 99