Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Find and replace special characters in Cocoa apps System
If you want to replace some string with another string that contains, a carriage return using the find/replace panel in TextEdit (or other Cocoa apps), it typically involves selecting a carriage return in the text and copy/pasting it into the Replace text field.

However, you can enter a carriage-return (or any other "special" keystroke like "Tab") into the Replace field by prefixing it with a Control-Q. That is, if you wanted to find all occurrences of ';' and replace them with ';[Return]', you would type a bare ";" into the Find field, and then type ';[Control-Q][Return]" into the replace field (that is: a semicolon, then a Control-Q, then hit the Return key).

Histroy: Control-Q is the keybinding used by emacs that basically tells emacs to insert the next typed character as a raw keystroke instead of going through the normal input-and-interpret engine. This should work in any Cocoa application.
  • Currently 4.20 / 5
  You rated: 2 / 5 (5 votes cast)

Find and replace special characters in Cocoa apps | 3 comments | Create New Account
Click here to return to the 'Find and replace special characters in Cocoa apps' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Authored by: a1291762 on Oct 09, '02 05:52:36PM

I have wanted this for ages!

I'm a vi user, where the equivalent key is Control-V.

Maybe I'll look at emacs bindings to see what else you can do with text boxes in OS X...

[ Reply to This | # ]
Better use Option key
Authored by: tinb on Oct 11, '02 05:06:20AM

Control-Q[Return] does not work for me in search fields. I've tried this in TextEdit.
Nevertheless it seems much more easy to me to use Option-[Return] to enter a [Return] into search or replace fields. This works also with Option-[TAB].

[ Reply to This | # ]
works in Address Book
Authored by: Scripter12 on Oct 14, '02 05:08:23PM

It works in Address Book. Now I can enter a two line Job Title. I also tried option Return but this did not work. It just jumped to the next field.

[ Reply to This | # ]