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


Click here to return to the 'Insert non-breaking spaces' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Insert non-breaking spaces
Authored by: almostHandsome on Mar 01, '10 08:07:16PM

In OS X, you can easily create new shortcuts.

Create a file called: ~/Library/KeyBindings/DefaultKeyBinding.dict
using a plain text editor.

Add a line like:
"^`" = ("insertText:", "‑"); /* nbhy */

This means "Control-` generates a command to insert a non-breaking hyphen character.

You can also insert a whole word, which is good for words or sequences of words you type often that are long like:
"^M" = ( "insertText:", "Massachusetts" );
"^N" = ( "insertText:", "New Hampshire" );
which means Control-M (not Control-m) inserts Massachusetts.

You can also use 2 character sequences, like
"^s" = {
"^c" = ("insertText:", "✔");
"^x" = ("insertText:", "✘"); /* X Symbol */
"^1" = ("insertText:", "¹"); /* superscript 1 */
"^2" = ("insertText:", "²"); /* superscript 2 */
"^3" = ("insertText:", "³"); /* superscript 3 */
};
Then Control-s followed by Control-c enters a check mark, etc.

Yes, this also be used for commands like:
"^a" = "deleteToBeginningOfParagraph:";
which is similar to the built-in Control-k command (delete to end of paragraph and put it in the yank buffer).

Or to move the cursor right by 7 words:
"^\UF703" = (
"moveWordForward:",
"moveWordForward:",
"moveWordForward:",
"moveWordForward:",
"moveWordForward:",
"moveWordForward:",
"moveWordForward:"
);

I get endless amusement out of this kind of thing.



[ Reply to This | # ]