+41

"Find in selection" shouldn't be the default

Rob Speer 6 years ago • updated by Charlie 6 months ago 13
Finding text inside my selection is never what I want to do, and yet it happens by default if anything is selected.

This makes me think that text doesn't exist in my code, when it actually does.

It's particularly bad because if I've just searched for something else, the result is *selected* and I have to clear the selection before I can proceed!
Find in selection is only the default if multiple lines are selected when opening the find panel.
+9
It would be nice to be able to disable this behavior. I also run into it all the time.
+2
I definitely run into behavior on a regular basis where I have only a few characters selected (all on the same line) and find acts as if 'find in selection' is selected.
When this happens the 'find in selection' button on the status bar is *not* depressed, but the find fails because the search is only happening in the selected region.

I haven't narrowed it down completely, but I *think* it happens with sequences like:
* search for something (which leaves some snippet of text selected)
* switch to another app (e.g. my the browser)
* switch back to sublime and try a search

I don't have a 100% repeatable way to reproduce this, but I run into quite often.

I notice this mostly on Mac, but it may also happen on Linux. I'll try to narrow it down more.
-1

The feature may be logical and consistent, but that doesn't mean anybody wants it ;)


It would be just as logical and consistent, though different, if Sublime just left "In Selection" set to the last used state. That way, if I'm doing a job where I need to "Find In Selection" a lot, I know it'll stay selected all evening (until I manually untick it again)


Love the program, by the way. I feel a bit guilty leaving these complaints.

+3

I run into the same problem. I frequently do stuff like: select a block of text, copy it, then find to jump to the place where I want to paste it, then I'll edit it as appropriate for the new location. Whenever I do this in Sublime, I end up bumping into this "find in selection" default. I know everyone wants different defaults, which requires taste on your part, but I'd be happy with a config flag.

We aren't the only people who find this weird:


http://twitter.com/#!/ericflo/status/112991059503616000

http://twitter.com/#!/ericflo/status/112991902911037440 


I see the same behavior as Tom Keane. Very frustrating. Would love to get it fixed. I also would never want "Find in selection" unless I explicitly turn it on.
+5
Agreed.  Find in selection is something I do very rarely, one time in a hundred searches.  Which means that the other 99% of the time it comes up with find in selection by default, I think that the text I'm searching for does not exist.  A setting to change this default would make this significantly more usable.
+2

I wouldn't mind this behavior if there were a keyboard shortcut that I could use from within "Find" to clear the selection. Is there one?

  { "keys": ["alt+c"], "command": "toggle_case_sensitive", "context":
     [
       { "key": "setting.is_widget", "operator": "equal", "operand": true }
     ]
   },
   { "keys": ["alt+r"], "command": "toggle_regex", "context":
     [
       { "key": "setting.is_widget", "operator": "equal", "operand": true }
     ]
   },
   { "keys": ["alt+w"], "command": "toggle_whole_word", "context":
     [
       { "key": "setting.is_widget", "operator": "equal", "operand": true }
     ]
   },
   { "keys": ["alt+a"], "command": "toggle_preserve_case", "context":
     [
       { "key": "setting.is_widget", "operator": "equal", "operand": true }
     ]
   },
Apparently these are the only toggle keybindings for find widgets. Seeing that they have a specific command name I don't think you can add a command yourself.

I end up most of the time wondering why nothing is found as I type, then realize that this option is enabled. The fastest way I have to fix the situation without using the mouse is to press ESC twice (once to stop finding, once to clear the selection) and then do Cmd-F again.

This is rather counter-productive.

+3

This continually bugs me too. I’m on a Mac, and a very common use pattern that works everywhere is ⌘E to mark the selection as the text to find, then ⌘G to find next. But in ST2, this only works some of the time; at other times it tries to “find in selection” (and the text to find *is* the selection!). I haven't yet been able to determine the circumstances that lead to it working normally or with the incorrect “find in selection” behaviour.

+17

In my user sublime-keymap file, I use:


    { "keys": ["super+f"], "command": "show_panel", "args": { "panel": "find", "in_selection": false } }


So command-F never enables "find in selection" mode

I use "Find in Selection" all the time, though I do agree that find highlights words and that makes it annoying. In ST3 you can toggle find in selection by going to preferences and changing the option "auto_find_in_selection" to what you want.