Sublime Forum

Request: Mac: Use selection for find

#1

Hi folks,

When I’m building our app in the Terminal, or use Xcode or BBEdit, the “Use selection for Find” (Command-E) works transparently. This is not the case with Sublime, I have to copy and paste the text I’d like to search for into the Find field.

Could this be added to the next build, is there a solution already that I’m not aware of?

Thanks,

Akos

0 Likes

#2

If you are talking about selecting something in the current view (in ST2), then opening the Find panel and having what you selected in the Find dialog automatically, you can accomplish that by putting

    // If true, the selected text will be copied into the find panel when it's
    // shown.
    // On OS X, this value is overridden in the platform specific settings, so
    // you'll need to place this line in your user settings to override it.
    "find_selected_text": true

in your User preferences (Sublime Text 2 -> Preferences -> Settings-User).

If you are talking about copying something outside of ST2 and having it populate the Find dialog (via system copy buffer), I don’t know if that’s possible.

0 Likes

#3

Cmd+E uses the system find pasteboard in the current series of dev builds

0 Likes

#4

Build 2194.

When you say “system find pasteboard”, do you mean that if I search for a string in some other application and then return to ST2 and press CMD-E, it should search for the same term I searched for in the other application? I just experimented with Chrome and Pages, but it didn’t work.

Is that the expected behavior or am I misunderstanding?

0 Likes

#5

No, Cmd+E copies the selected text to the system pasteboard. Cmd+G finds the next occurrence of the text on the system pasteboard.

0 Likes

#6

Thanks, that’s the answer I was looking for!

May I have access to the dev builds some way or another?
—>Oh me, oh my, I’ve found it.

Thanks, Akos

0 Likes

#7

Please forgive me if I’m being dense, but I’m trying to wrap my head around how this system find buffer is supposed to work and I’m at least a little bewildered.

I’m bouncing back and forth between ST2 (2194) and Chrome (18) on Mac OS X 10.7.3. If I CMD-F (yes, that’s an F, not an E) in ST2 and type some search string, that same search string winds up in Chrome’s find (CMD-F) dialog automatically. If I change it in Chrome, it gets changed in ST2. Is this how it is supposed to work? If so, is there a way to disable it? I do not want my find dialog changing automatically on me in ST2.

0 Likes

#8

Your example is indeed the way it’s supposed to work: all applications on OS X work this way. There’s no setting to disable this within Sublime Text, and even if one was added, it’d seem futile: all your other applications would still use the shared system find pasteboard.

An example of making use of the find pasteboard: You see a function name you’d like to find some documentation on, so you select the function name, press Cmd+E to copy the function name to the find pasteboard, switch to another application with the documentation, and press Cmd+G to find the next occurrence of the string.

0 Likes

#9

Thanks for the reply and explanation, Jon. What has me scratching my head is I’m talking about CMD-F, not CMD-E. I’ve been using a Mac for 5 years and just hadn’t noticed it before, so either it’s something new(ish) or I just won’t encounter it often enough for it to be a real problem. I did some searching and there were complaints about this with Firefox about a year ago [1], but that was related to OS X 10.5, and appeared to be resolved in 10.6. I’ve done some quick testing with Safari and TextEdit, and it appears that this is something Apple has done at the OS level as they both exhibit the global behavior in 10.7. I can’t say that I like it, at least not yet. There are many times that I will switch away from one application and do something completely unrelated in another, and if I search in that other application, I don’t want my find dialog (or anything else!) changed in the first application without me explicitly initiating that change.

Thanks for being patient with me on this. Much appreciated.

[1] bugzilla.mozilla.org/show_bug.cgi?id=654125

EDIT: Another thread that suggests this is something Apple implemented at the OS level and there’s nothing we can do about it (it also suggests there are other people who dislike this functionality, so I’m not alone … yay!):

cocoabuilder.com/archive/xco … -apps.html

0 Likes