highlight or find all words which start with a capital letter - textmate

How to highlight or find all words which start with a capital letter in textmate?
I have lots of text (around 70 pages) which contains many words which unnecessarily start with a capital letter. I want to inspect all these words and change them to small if needed.
How can I do this in textmate?
any other editor you can suggest?
Im on OSX 10.6.8

Use the Find feature (Command-f). In the top (Find) box, put:
\b[A-Z][a-z]+\b
Then check the box for Regular Expression and uncheck the box for Ignore case. Hit OK. Use Command-g and Command-shift-g to navigate from word to word.

Related

Notepad++: last occurrence of string

I want to find the last occurrence of a string in a large text file in Windows. Is there a way to do this using Notepad++ (also do suggest methods beyond Notepad++ if you know a better method)?
I don't want to install any add-on or anything else, if possible.
Thanks.
Just press Ctrl+F or from the Menu - Search -> Find
and then type your string in search field.
In direction choose Up, and it will start from the end.(Make sure you haven't point your mouse anywhere on the text before all this, or it is before the first character in the file.)

Sublime Text 3 unable to find text that is plainly there

Hitting cmd+f to find text in SublimeText, I frequently see something like:
Clearly 'someText' exists on the page. Why can't Sublime find it?
Note this sometimes seems to work, and sometimes fails. I can't work out the difference though.
How can I reliably find text with Sublime Text?
I've tried to reproduce this problem with Sublime Text 2 and this is what I found:
If you place caret before the text and the hit find, the text will be found
If you place the caret after the text and then hit find, the text will not be found
It seems that Sublime Text doesn't wrap search by default. You can enable it by toggling the button with the arrow icon (second one from the left of Find what, its tooltip should say Wrap). Then the search works regardless of the caret position.
Look at the buttons right before search box. Sometimes they are just get disabled accidentally, mis-click, or the short-cut get trigged, then the search doesn't behave as expected.
From left to right, RegExp, case sensitive, whole word, wrap(search whole doc, not just below current line), you can see them with mouse pointer hover.
I strongly suggest you to disable those shortcuts to prevent unexpected toggle of these :)
Also, turning off the regex may help you in searching for symbols which have special meaning in regex. For instance, someText(foo) will not be searchable in regex mode without escaping the brackets or putting the search string in quotes.

Sublime Text 2—Quickly find something on a page

I've been trying out Sublime for the past few days. Long-time TextMate user.
The one thing I struggle with most is finding stuff in a document. I can use CMD+r to find a selector, but what if I'm looking for something else, a comment maybe, or something else?
If I use CMD+f, Sublime will put a box around all of the instances of my search term, which isn't what I want either. Worst, it keeps a box around all of the instances:
http://cl.ly/1T3x0i2L0j2u1a0E0M12.jpg
I need to "disengage" the find before I can move on.
Is there a TextMate "QuickFind" (Ctrl+s) equivalent in Sublime Text?
I find searching/navigating through a document in Sublime to be really, really frustrating.
After looking for a very long time, I've found it. The Sublime equivalent to Textmate's quick search/find is Find > Incremental Find, or cmd+i.
Now, I'm officially a Sublime convert.
Worst, it keeps a box around all of the instances (see screenshot: http://cl.ly/1T3x0i2L0j2u1a0E0M12). I need to "disengage" the find before I can move on.
To disengage find in sublime text 2 just press Esc key.
On top of using Find as per usual, if a find is for a small amount of characters that would appear 50 times on a page, use the EasyMotion plugin which does that old Vim deal:
You hit the EasyMotion key, hit the character you want to match, then Sublime replaces all visible instances of that character with a letter, number, etc - you then hit that replacement character on your keyboard and the cursor moves to that particular instance of the character you wanted. It's a bit confusing to explain but basically, it lets you teleport to absolutely arbitrary points on any page in 3 key presses.

TextMate - Find & Replace Selected Text

In TextMate, does anyone know how you find & replace selected text?
Is this what you're looking for? http://manual.macromates.com/en/working_with_text
4.5.2 Find Clipboard
Two useful key equivalents are ⌘E and
⌘G. The first copies the selection to
the shared find clipboard. This works
in the majority of applications and
allows you to find the next occurrence
of that string by then pressing ⌘G.
The find clipboard works across
applications so whether in Safari,
TextEdit, Mail, TextMate, Terminal,
Console, or similar, one can copy the
selected text to the find clipboard,
switch application and use ⌘G to find
that string.
In addition TextMate offers ⇧⌘E to
copy the selection to the replace
clipboard. This is often useful to
save a trip to the find dialog, for
example if you want to replace
newlines with the pipe character (|)
for a list of items, select a newline,
press ⌘E to use that as the find
string. Now type a |, select it and
press ⇧⌘E so that it is copied to the
replace clipboard.
The next step is then to either press
⌃⌘F to perform the replacement in the
entire document, or select the range
in which you want the replacement to
occur and use ⌃⇧⌘F instead.

Conventions for the behavior of double or triple "click to select text" features?

Almost any mature program that involves text implements "double click to select the word" and, in some cases, "triple click to select additional stuff like an entire line" as a feature. I find these features useful but they are often inconsistent between programs.
Example - some programs' double clicks do not select the ending space after a word, but most do. Some recognize the - character as the end of a word, others do not. SO likes to select the entire paragraph as I write this post when I triple click it, VS web developer 2005 has no triple click support, and ultra-edit 32 will select one line upon triple clicking. We could come up with innumerable inconsistencies about how double and triple click pattern matching is implemented across programs.
I am concerned about how to implement this behavior in my program if nobody else has achieved a convention about how the pattern matching should work.
My question is, does a convention (conventions? maybe an MS or Linux convention?) exist that dictates how these features are supposed to behave to the end user? What, if any, are they?
I don’t believe there is a standard to the level of specification you want, and there probably shouldn’t be. Apple Human Interface Guidelines are the most complete. With respect to selecting content (as opposed to controls or discrete data objects), they say:
Double-clicking is most commonly used as a shortcut for other actions, such as… to select a word. Triple-clicking selects the next logical unit, as defined by the application. In a word-processing document, triple-clicking in a word selects the paragraph containing the word…. Double-clicking within a word selects the word. The selection should provide “smart” behavior; if the user deletes the selected word, for example, the space after the word should also be deleted… In some contexts—in a programming language, for example—it may be appropriate to allow users to select both the left and right parentheses (or braces or brackets) in a pair, as well as all the characters between them, by double-clicking either one of them.” (p115-116)
Apple is quite specific about what characters are and aren’t included in a word.
Microsoft’s Windows User Interaction Experience Guidelines say:
For some types of selectable objects, each click expands the effect of the click. For example, single-clicking in a text box sets the input location, double-clicking selects a word, and triple-clicking selects a sentence or paragraph. (p430)
Java Swing Look and Feel Design Guidelines say:
Double-clicking (clicking a mouse button twice in rapid succession without moving the mouse) is used to select larger units (for example, to select a word in a text field)…. Triple-clicking (clicking a mouse button three times in rapid succession without moving the mouse) is used to select even larger units (for instance, to select an entire line in a text field)…. A triple click in a line of text deselects any existing selection and selects the line.
The Gnome Human Interface Guidelines don’t say much about what double- and triple-clicking should do.
This gives you the freedom to choose whatever is best for your users. Double and tripling clicking are expert shortcuts, so their behavior should aim to maximize efficiency. Consider why the user is selecting something and design to make that easiest and fastest.
For example, apparently the rationale behind including the trailing space when double-clicking a word is that users usually select a word in order to copy or paste it in another position in the text. This implies you automatically include the trailing space in order keep the user from having to manually delete a remaining extra space at the source and add a word-separating space at the destination.
Likewise if users are selecting a line of code or paragraph to copy or move it somewhere else, then you probably want to include the newline characters so the user isn’t left with an empty line at the source and force to manually add a newline at the destination (assuming they didn’t want to take the line/paragraph and combine it with another line/paragraph.
If selection is for something other than copying and moving text in sentences, then none of this may apply and you don’t necessarily want to include trailing spaces or newlines. That’s why there shouldn’t be a standard.
An alternative is to do what Apple calls Intelligent Cut and Paste (see the Human Interface Guidelines), or Microsoft Word’s Smart Cut and Paste, where spaces, newlines and other adjustment are algorithmically figured out when cutting, copying, pasting, and deleting, not when selecting.
In my perfect world I would have it work like this.
Double click on a word selects the word only (a word according to the grammar rules of the locale), no trailing space (this is for easier copying between programs so that I would not need to remove any spaces when pasting)
If I remove the selected word my text editor is aware of my content and removes any additional spaces left over
A triple click selects a line with no trailing newlines. (A paragraph is a long line that has been wrapped)
In Windows, Linux and OS X double-click selects the word under cursor triple-click selects the entire line of text (single line only, i.e., wrapped line)
Finding answers and come up with a alternative solution:
I like to write code or command in text, and copy them to shell prompt without the ending \n
1. use notepad
2. surround each line with ()
3. use ctrl + double click.
Fine...

Resources