Is there a way to highlight some text, and then have vim search for that
text? I know about using * on a single word, but what if I want to
search for two words?
Thanks!
Mark
I just yank visually-selected text to the clipboard and replace it on
the ':s///' line.
Remember to escape magic chars. Eg, if you highlight and grab a path
like
fooey_files/image.gif
go back and escape the '/' with a '\', ie,
fooey_files\/image.gif
before continuing.
I don't know of any "direct" way of doing so, but you might be able to
set some mouse option to automagically yank to the clipboard any
visually-selected text. I normally eschew using the mouse, so I'm not
that familiar with mouse options.
The easiest way is using word1\|word2 however both will be higlighited
in the same color then..
Marc Weber
<shift-insert> does.
(And if anyone starts in with, "But e-z-edit on kde gnome ultra running
4.2 through remote-X uses control-alt-shift-meta insert instead...", I
don't wanna hear it. Find what works for you, and use it, a'ight?)
:help c_CTRL-R
:help c_CTRL-R_CTRL-F
Also, since the 0 (zero) register holds the last text yanked, you
can highlight some text in the body, type y to yank it, then as
you're typing on the command line, type Ctrl-R and 0 to put that
text there. (You can put from the " register instead of from the 0
register, but I find 0 easier to type and it doesn't get overwritten
by deletes.)
:help quote0
:help quotequote
Regards,
Gary
You can yank to any register. (:h registers) which is done automatically
when you yank or delete text. You can also "ay to put into register a.
You then use (in cmd line or insert mode (buffer)) ctrl-r <register>
(<register> beeing etiher * + or one of the others..)
As alternative you can press q: to get a cmd line buffer window.
There you can yank/ copy /paste as normal.
cu Marc
1. Select the text using characterwise or linewise VISUAL (v or V), not
SELECT (i.e. not shift-cursor).
2. Yank it to the unnamed register using y
3. Start your command-line
/
4. Insert the unnamed register
Ctrl-R " (control-R then double-quote with no intervening space) -- see
":help c_CTRL-R"
5. If there are "special" characters in the just-pasted text (backslash,
forward slash, period, circumflex, dollar, opening bracket, asterisk),
backslash-escape them by editing the command-line -- see ":help
pattern-overview".
6. You may or may not want to insert \< (start word) and/or \> (end
word) at the ends of your search pattern. If you do, do it now, by
command-line editing.
7. Check your search command-line, then hit Enter. Voilà!
Best regards,
Tony.
--
"There is nothing which cannot be answered by means of my doctrine,"
said a monk, coming into a teahouse where Nasrudin sat. "And yet just
a short time ago, I was challenged by a scholar with an unanswerable
question," said Nasrudin. "I could have answered it if I had been
there." "Very well. He asked, 'Why are you breaking into my house in
the middle of the night?'"