Sho
Sho

Reputation: 184

Sublime Text 2 shortcut to select a sentence

Any keyboard shortcut in Sublime Text 2 to select the string in quotation marks:

<input type="text" value="i want to select these texts ..." />
alert("i want to select these texts ...");

Upvotes: 0

Views: 1316

Answers (2)

skuroda
skuroda

Reputation: 19744

Try the BracketHighlighter plugin. Use the command palette command Select Bracket Content. I believe that is what you are looking for. If it is, you can create a keymap with the following command (got this from logging the command, but you can also see it by looking through the sublime-commands file)

"keys": ["<you choose keys>"],
"command": "bh_key",
"args": {"lines": true, "plugin": {"command": "bh_modules.bracketselect", "type": ["__all__"]}}

Upvotes: 1

MattDMo
MattDMo

Reputation: 102852

Under the Selection menu is an option Expand Selection to Scope, which should be what you're looking for, since strings enclosed in quotes are defined as a separate scope in most languages, including the default HTML that comes with ST2.

I tested several languages, including HTML, JavaScript, JSON, Ruby, Perl, and Python, and all except Python selected the quotes along with the text. If you want to change that behavior you'll have to dive into Packages/Python/Python.tmLanguage, figure out the regexes involved, and transfer them to the .tmLanguage file(s) of your language(s) of choice.

Upvotes: 2

Related Questions