在 2013年7月11日星期四UTC+8下午7时58分17秒,Christian Brabandt写道:
> On Thu, July 11, 2013 09:31, [email protected] wrote:
> 
> > Hi All
> 
> > I want to use the below command  in command line to search my specified
> 
> > pattern in the text
> 
> > :normal /pattern
> 
> >
> 
> > However, it doesn't take effect in my current version:gVim 7.3.46
> 
> >
> 
> > anyone knows how to correct this command or other comments?
> 
> >
> 
> > My request is from below case:
> 
> > used for I want to set my own command to search the pattern when I did the
> 
> > selection on the konsole terminal
> 
> >
> 
> >
> 
> > currently I could use below succesfully to insert some text which I
> 
> > selected on the konsole.
> 
> > :command Joe :exec "normal i" . @*
> 
> >
> 
> > but can't I can't use below to search the pattern text which I selected on
> 
> > the konsole.
> 
> > :command Joe2 :exec "normal /" . @*
> 
> >
> 
> > and I guess it's due to the "normal /" is not a correct or complete
> 
> > command here.
> 
> >
> 
> Well, when you are searching using '/' you need to press enter to stop
> 
> entering pattern and actually start the search. So you are at least missing
> 
> the ."\<cr>" part at the end of your command. But using normal for this
> 
> is clumsy and I would do it like this:
> 
> 
> 
> :com Joe :let @/=@*|norm! n
> 
> 
> 
> Depending on your pattern, you might need to escape certains things, e.g.
> 
> to search literally use something like this:
> 
> 
> 
> :com Joe :let @/='\V'.escape(@*, '\\')|norm! n
> 
> 
> 
> 
> 
> BTW: you usually want :norm! instead of :norm
> 
> 
> 
> See also the help:
> 
> :h escape
> 
> :h :norm
> 
> 
> 
> regards,
> 
> Christian
Your below point 
:com Joe :let @/=@*|norm! n
is used to search text which may include slash or not
:com Joe :let @/='\V'.escape(@*, '\\')|norm! n
is used to search any text literally which may have ",@,/,\ ...etc and without 
extra manual escape process.
is like something they are talked about in 

http://vim.wikia.com/wiki/Searching_for_expressions_which_include_slashes

this issue has been resolved.
thanks a lot.

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

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to