62

One thing that's really bugged me since switching to Chrome is that Ctrl + F behaves slightly differently from Firefox.

In Firefox, if you have text highlighted and hit Ctrl + F, it'll start finding with that text.

Is there any way of getting Chrome to do this?

Gaff
  • 18,569
  • 15
  • 57
  • 68
therefromhere
  • 8,412
  • 10
  • 42
  • 43

5 Answers5

45

This issue was once raised in Chrome and is documented in :
Issue 6356004: If the user selects text in the current tab, and types CTRL-F,... (Closed)

In this Issue article, six successive patches were applied to Chrome to enable this functionality. However, because of too numerous unsolved issues, such as line breaks and other characters that can't be printed in the find box, the developer Simon Morris has given up and concluded :

Besides these issues, this behavior just doesn't feel terribly compelling when testing it. Perhaps I'm too used to the existing Chrome behavior, but while I expect prepopulation based on previous search strings in this or other tabs, I don't really expect selecting text to change my search string, and it doesn't feel terribly hard to sandwich the ctrl-f in a ctrl-c/ctrl-v pair to be explicit, given that I've just selected what I want to search for.

Since Ben already voted against this and the above testing doesn't give me strong counterarguments, I'm going ahead and closing.

I see this as pure laziness, as this problem and others were easily solved in other browsers. I have also searched but not found any Chrome extension that solves the problem.

The only solution I can therefore suggest, is to use a keyboard macro bound to a hotkey to issue the series of "Ctrl+C Ctrl+F Ctrl+V".

If you are on Windows you can use a Autohotkey script for this.
See this thread for an example : Chrome extension for highlight+find prepopulate?

An Autohotkey script can also be bound to a given process or window, so one can further fine-tune this script to apply only to Chrome.

If you are on Linux, you can use this port of Autohotkey : IronAHK, which runs on .NET or Mono for Linux/Mac. This article might be useful : Install IronAHK on Linux.

harrymc
  • 455,459
  • 31
  • 526
  • 924
12

If you really crave for that behavior, download AutoHotkey and load the following script:

~^f::
SetTitleMatchMode 2
IfWinActive, Google Chrome
{
  Send, ^c
  Send, {F3}
  Send, ^v
  Send ^a
  return
}
else
{
  Send ^f
  return
}
Mr. Polywhirl
  • 540
  • 5
  • 11
tumchaaditya
  • 3,752
  • 5
  • 39
  • 57
8

Actually the feature is there, at least on Mac OS.

It's called "Use selection for Find" and it's bound to +E.

Press +E +G to highlight all words equal to the selected!

Press +E +F +G to start a search with the current selection.

(Can't check on Windows, but it seems not to have the feature altogether)

caesarsol
  • 410
  • 4
  • 6
  • 1
    Ctrl+E brings up a "Search Google" prompt in the address bar. – mbomb007 Jul 26 '17 at 19:18
  • 1
    For me, it only works when the search is already open. – xpy Sep 07 '18 at 07:55
  • @xpy you can try with Cmd+E, Cmd+F, Cmd+G in sequence – caesarsol Sep 12 '18 at 08:08
  • 2
    @mbomb007 Mac Keyboards have a ctrl key and a 'cmd' key. Clearly the icon he showed there (besides being particular to a MAC Keyboard), is the mac keyboard's cmd key, not ctrl key. – barlop Sep 12 '18 at 10:37
  • @barlop Right, I think the Windows equivalent of the Cmd key is the Windows key. – mbomb007 Sep 13 '18 at 02:06
  • @mbomb007 Not equivalent at all eg infact if you want to copy on a mac, you do cmd-c not the windows key. And in windows Window Key E brings up an explorer window. So even in this context it's not equivalent, and if you tap the key without anything then it's different. So you're just totally wrong – barlop Sep 13 '18 at 06:15
  • @barlop My fault, I just edited the answer but I initially suggested to try CTRL+E on a Windows, could maybe have the same effect. Turns out it doesn't, so I updated the answer thanks to mbomb007. Based on Chrome docs, the feature is non-existent in Windows – caesarsol Sep 13 '18 at 10:57
  • 2
    @barlop The OS can interpret the keys differently, but if you plug a mac keyboard into a windows computer, the Cmd key is the Windows key. They are both the same keyboard input. – mbomb007 Sep 13 '18 at 14:26
6

I use Ctrl+C, Ctrl+F, Ctrl+V - at least they are close together on the keyboard and reasonably quick to type.

Linger
  • 3,274
  • 10
  • 35
  • 47
Hugh Allen
  • 9,820
  • 6
  • 34
  • 42
  • 4
    `Ctrl` can be even pressed down the whole time. – Daniel Beck Apr 10 '11 at 11:43
  • @Daniel Beck: yes that's what I do, I just thought it clearer to spell out that Ctrl is needed for the last two keys as well as the first. – Hugh Allen Apr 11 '11 at 02:20
  • Maybe I misunderstood the question, but either way, how is this any use though. It'd be useful if it could search within highlighted text. But this just finds a lump of text that he already found when he selected it. If it was searching within highlighted text then that'd be useful – barlop Sep 12 '18 at 10:40
  • 3
    @barlop it is useful to find other occurrences of the same piece of text. I don't know of any browser that has the feature to search within selected text, though it would sometimes be useful. Perhaps you could write an extension to do that. – Hugh Allen Sep 15 '18 at 13:03
0

I wrote a chrome extension with 5000+ users and recently ported it to firefox, it won’t populate the find palette but it automatically highlights all occurrences, maintains your original selection, shows scroll markers, and is configurable (gate key, window location rules, ancestor rules, etc)

see https://github.com/neaumusic/selection-highlighter

neaumusic
  • 243
  • 1
  • 2
  • 10