Text Mate double quote a selection? - textmate

is there an easy way within TextMate that I can select a string, hit some key and magically it will surround the string with double quotes.
For example:
I have some text here
I select this text, use some command sequence and I have:
"I have some text here"

Sure! once you have selected the text, the key is "

Handy extra tip: don't miss Ctrl-Shift-' (that is, Ctrl-") to toggle the quotes surrounding the cursor from single to double quotes.

Related

Enclose code in braces and indent automatically in Xcode?

Is there any convenient way to do all these things at once in Xcode?
Take a selected block of text and enclose it in a set of curly braces, each on their own line, with proper indentation like this:
Before:
idea.ponder()
doSomething()
After selecting the 2 lines and hitting a shortcut:
{
idea.ponder()
doSomething()
}
… preferably with the cursor positioned just before the opening brace.
That way I could just, for instance, type withAnimation or DispatchQueue.main.async or if !tooSleepy and be on my way.
I find myself doing this sort of thing manually so often, and I've never seen a convenient Xcode shortcut. (Though there are shortcuts for indenting, for wrapping in braces without adding newlines, etc.) Am I missing something?
thanks!
On my machine, selecting the lines and typing a left curly brace does exactly what you just said. Example:
self.contentView.layer.cornerRadius = 8
self.contentView.backgroundColor = .blue
I select both lines (triple-click-and-drag) and hit { key, and I get
{
self.contentView.layer.cornerRadius = 8
self.contentView.backgroundColor = .blue
}
To get the cursor before the first curly brace, choose Editor > Selection > Balance Delimiters (you can give that a shortcut) and then left-arrow.
An alternative approach might be: select and cut the lines, use code completion to insert the desired construct, then paste the lines back in.

Automatic close quotes on Xcode

Is there any way to have a second double quotes placed automatically, when I enter the first one in Xcode? There aren't any settings in Xcode regarding placing a second double quote automatically when entering the first one (like in VSCode eg).
Let the autocompletion work.
i.e.Type print then autocomplete to print(items: Any...) then press "
or ^"
take a look at this https://developer.apple.com/library/content/documentation/IDEs/Conceptual/xcode_help-command_shortcuts/TextCmdsByType/TextCmdsByType.html

ckeditor bullets open and close double quotes

With CKEditor I need to give the user keyboard entry of bullets, left-double-quotes and right-double-quotes.
I already provide the user with numbered and bulletted lists, they want stand-alone bullets.
When I say left-double-quote, I mean “ &#8220 equivalent.
When I say right-double-quote, I mean ” &#8221 equivalent.
The user wants the ability to type these characters directly into a CKEditor textarea.
How should I configure CKEditor to do this?
I solved this problem during the export to IDML by converting the quotes (""") to their respective ” and “ (&#nnnnn; equivalent) by evaluating the characters next to the quote.
So the user may input ", and I output the desired quote character in it's place.

Sublime Text 3: Use double underscore "__" as word separator

I am trying to use a double underscore "__" as word separator in Sublime Text 3. That means, I want the following to be selected by a double click (selection indicated by brackets):
(bar_foo)
(hello)__(world)
Is that possible? My first guess is "no", because nothing is specified in Preferences.sublime-settings, but maybe one of you guys knows a way to make this work?
Thanks in advance!
PS: I already had a look at some questions here at SO (e.g. Removed hyphen from word_separators, ctrl+d no longer makes sense and Sublime Text and Hypens vs Underscores), but they don't answer this specific question.
Edit: In case you're wondering, I want this because I want to select variables like bar_foo_counter but I also want to use double underscores for my CSS modifier classes, like bar__inner.

How to delete line break in textmate

How to find and delete all the line breaks? I tried \n and it doesn't work! Regular expression? what kinda of expression?
I found the answer in the TextMate IRC channel.
Press Option Return to search for literal line breaks in the Find and Replace panel.
Searching for \n works if you select the "Regular Expression" option, but won't work in the literal search mode.
Without regex (regular search):
Alt + ⏎
Select the empty space in between the lines and Copy. Then Select the block of text you want to remove line breaks from. Go to Find & Replace. Paste the copied empty space in the Find field. Type a space in the Replace field. Hold Option, which toggles Replace All to In Selection, then click In Selection. This should do the trick.

Resources