'*' search without cursor move

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

'*' search without cursor move

Woody Wu
Hi,

When I use '*' command to search and highlight current word in a file,
the cursor also moves to the next match.  But at many cases, I hope
the cursor can be stay where it is and don't move at all.   Can I?
Thanks.

--
Life is the only flaw in an otherwise perfect nonexistence
    -- Schopenhauer

narke
public key at http://subkeys.pgp.net:11371 ([hidden email])

--
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|

Re: '*' search without cursor move

panshizhu
Steven Woody 写道:
> Hi,
>
> When I use '*' command to search and highlight current word in a file,
> the cursor also moves to the next match.  But at many cases, I hope
> the cursor can be stay where it is and don't move at all.   Can I?
> Thanks.

press * then press # will send you back.

so if you want the cursor back, map something to *#

--
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|

Re: '*' search without cursor move

Woody Wu
2009/12/22 pansz <[hidden email]>:

> Steven Woody 写道:
>> Hi,
>>
>> When I use '*' command to search and highlight current word in a file,
>> the cursor also moves to the next match.  But at many cases, I hope
>> the cursor can be stay where it is and don't move at all.   Can I?
>> Thanks.
>
> press * then press # will send you back.
>

That's an idea~  thanks.

> so if you want the cursor back, map something to *#
>
> --
> You received this message from the "vim_use" maillist.
> For more information, visit http://www.vim.org/maillist.php



--
Life is the only flaw in an otherwise perfect nonexistence
    -- Schopenhauer

narke
public key at http://subkeys.pgp.net:11371 ([hidden email])

--
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|

RE: '*' search without cursor move

JohnBeckett
In reply to this post by Woody Wu
Steven Woody wrote:
> When I use '*' command to search and highlight current word in
> a file, the cursor also moves to the next match.  But at many
> cases, I hope the cursor can be stay where it is and don't
> move at all.

The main search tip is:
http://vim.wikia.com/wiki/Searching

and it links to this which has a section on your question:
http://vim.wikia.com/wiki/Highlight_all_search_pattern_matches

John

--
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|

Re: '*' search without cursor move

Roald de Vries-2
In reply to this post by panshizhu

On Dec 22, 2009, at 4:26 AM, pansz wrote:
>> Hi,
>>
>> When I use '*' command to search and highlight current word in a  
>> file,
>> the cursor also moves to the next match.  But at many cases, I hope
>> the cursor can be stay where it is and don't move at all.   Can I?
>> Thanks.
>
> press * then press # will send you back.

When typing, I would personally prefer *N

--
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|

Re: '*' search without cursor move

Matt Wozniski-2
On Tue, Dec 22, 2009 at 5:16 AM, Roald de Vries wrote:

>
> On Dec 22, 2009, at 4:26 AM, pansz wrote:
>>> Hi,
>>>
>>> When I use '*' command to search and highlight current word in a
>>> file,
>>> the cursor also moves to the next match.  But at many cases, I hope
>>> the cursor can be stay where it is and don't move at all.   Can I?
>>> Thanks.
>>
>> press * then press # will send you back.
>
> When typing, I would personally prefer *N

Or at least #* so that the search direction would be correct.

~Matt

--
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|

Re: '*' search without cursor move

Tim Chase
>>> press * then press # will send you back.
>> When typing, I would personally prefer *N
>
> Or at least #* so that the search direction would be correct.

...with the caveat of watching how 'wrapscan' is set...

-tim


--
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php