On 09/02/11 06:43, John Goche wrote:
foo.bar.cat.nav

the cursor is over "bar". I want to search for "bar.cat".
That should be three words including the dot. I would
like to give the command

3*

This (as you may have discovered) searches for the third match of the single word under the cursor.

but it does not work as I wish. Instead I have to specify
the '/' (forward slash) and type bar.cat manually.

Anyone have a solution or should I submit a feature request?

Knowing were to delimit and how many words/Words to find becomes a bit tricky. However, for the most part, you can yank the terms and then paste them into the search expression. So as above, you can do something like

  y3iw
  /<c-r>"

which will yank 3 "inner words" (if the cursor is, as you say, over "bar" and you want to search for "bar.cat", as "bar", ".", and "cat" are each found as a word) and then control-R followed by the double-quote (to paste the scratch register into which the words were yanked). This doesn't escape the metachars, so the search will then find not only "bar.cat" but "barxcat" or "barfcat". There are ways to escape them, but you might then want to investigate searching for visually-selected text[1]. This would allow you to use the mapping at that link to do

  v3iw*

to visually select the desired 3 words and then search for the highlighted content.

-tim

[1]
http://vim.wikia.com/wiki/Search_for_visually_selected_text






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

Reply via email to