Select text between quotes? - sublimetext3

It drives me mad. I can found how to select text between quotes in mac.
I have not installed any plugins. But i can select text pressing -
Ctrl + Shift + Space
Combination - Ctrl + Shift + M - fro selection text between brackets works good.
Please help me.

There is a plugin specifically for this task: Expand Selection to Quotes. Simply put your cursor between two quotes and hit Ctrl' to select the text between the quotes. Hit it again and it will select the quote marks themselves.

You can use the Plugin BracketHighlighter to achieve what you want. First, you need to install this Plugin. Then, go to Preferences --> Key Bindings.
Add the following key bindings,
{
"no_outside_adj": null,
"keys": ["ctrl+alt+super+s"],
"command": "bh_key",
"args":
{
"lines" : true,
"plugin":
{
"type": ["__all__"],
"command": "bh_modules.bracketselect"
}
}
}
Then you can use the shortcut key Ctrl+Alt+Super+S to select texts between quotation marks.

Ctrl + Shift + Space
works for me - it selects the text in quotes WITH quotes. But it's not a problem since I then just start typing quotes, and then what's inside...
No relevant plugins installed. Windows 10.

I figured out this, you can use plugin BracketHighlighter for this task.

Sublime Text 3 (Build 4113) on OSX natively supports selecting many different kinds of text between quotes (ie, not just words, but also sentences, uuids, datetimes, and more) without selecting the quotes by clicking on the text inside the quotes that you want to select and using Selection > Expand Selection. Shortcut: ⇧ Shift + ⌘ + A.

Related

Highlight matches 'quotes' and "double quotes"

How can I highlight matches for single quotes ('quotes') and double quotes ("double quotes")?
I read the docs and I saw there is something for brackets and tags:
"brackets_options":"foreground",
"brackets_foreground":"var(orange)",
"bracket_contents_options":"foreground",
"bracket_contents_foreground":"var(orange)",
"tags_options":"foreground",
"tags_foreground":"var(orange)",
but didn't found any solution for quotes.
Is there any option like "quote_options" or something like that with the same behavior as for brackets and tags?
I know about BracketHighlighter but this plugin is so slow and I generally prefer native options
I am working with:
PHP, HTML, JS
Default Mariana color scheme
Default theme
Sublime Text ver.: 3
There is no option to highlight quotes, but you can select all between the quote tags by using Selection | Expand selection to Scope or shortcut Ctrl + Shift + Space if you are looking for some functionality to "see" everything between the quotes.
Example when you click somewhere in between the quotes and use above mentioned functionality:

How can I write to multiple lines simultaneously in Geany?

I want to modify the beginning of every line of a txt file in Geany. Somehow it is possible to write in multiple lines at the same time (maybe with box selection?).
How to do this?
You need to install before the plugin Extra Selection.
For my configuration (Debian/Buster, Geany 1.33) I add to configure shortcuts key.
See plugin manual for more details :
Usage :
Under Tools -> Extra Selection, there are 7 new items: "Column
Mode", "Select to Line", "Select to Matching Brace", "Toggle
Rectangular/Stream", "Set Anchor", "Select to Anchor" and "Rectangle
Select to Anchor". Normally these should be bound to keys, for example
Alt-C, Alt-Shift-L, Ctrl-Shift-B, Ctrl+2, F12, Shift-F12 and
Alt-Shift-F12.
This is just an addition to the answer by #zaboop since the edit queue was full and many people might not have understood the solution properly.
In Geany you cannot edit different parts of multiple lines at once (like in VS Code) without using plugins.
Instead what you can do is you can edit the starting of multiple lines at once.To do so:
Hold Shift + Alt and press your up or down arrow keys to correspondingly select the lines above or below the current line.
Then release Shift + Alt and continue editing the lines.
No plugins needed.
Strangely, unlike the other answers, I had to press Shift + Ctrl while selecting a region, and selecting only works with the mouse, not with the keyboard. After selecting, I was able to edit multiple lines at once.
Configuration: (Debian-based) Raspberry Pi OS, accessed via VNC, Geany 1.33
Select the region, while pressing Alt-Shift, then move around with cursor with arrows.

Android Studio - jump back and forth between matching braces using a single key sequence

I had to move from Eclipse to Android Studio for Android development. Many features are better, several are worse. In particular I miss the jump between matching braces (opening -> closing brace and v.v.) by means of a single key sequence.
I managed to find that CTRL ] takes you from the opening brace to the closing one, CTRL [ takes you from closing to opening brace. If the wrong [ or ] symbol is used when you ara already at an opening or closing brace, then the editor jumps to the next brace of that type.
Is there any key sequence which jumps between matching braces, like Eclipse does?
I think you want
Ctrl+}
Ctrl+{
these move to the open and close brackets.
You want a single combination to do both?
Use Ctrl
+ shift
+ M
Reference
If this helps anyone using Android Studio on a Mac OS X machine, to jump back and forth between matching braces or parentheses, use
control + m
or possibly
control + shift + m
I am using Android Studio 4.2.1 and now it seems like need to use cmd + shift + m to move to matching bracket.
Also, this one conflicts with one of the MacOS short cut and can be modified to ctrl + shift + m
Single key solution
You can do it as
Go to setting->keymap find Move Caret To Matched Brace add a shortcut to it.
That shortcut will take you to the end If you are at the opening brace And at the start if you are at the ending brace.
Additional :
1. For the Windows:
- Use <kbd>Ctrl</kbd>+<kbd>]</kbd> to move to the closing bracket.
- Use <kbd>Ctrl</kbd>+<kbd>[</kbd> to move to the opening bracket.
For the Mac:
- Use <kbd>cmd</kbd> instead of <kbd>Ctrl</kbd>.
2. For the Windows:
- Use <kbd>Ctrl</kbd>+<kbd>}</kbd> to move to the closing bracket with the code selection.
- Use <kbd>Ctrl</kbd>+<kbd>{</kbd> to move to the opening bracket with the code selection.
For the Mac:
- Use <kbd>cmd</kbd> instead of <kbd>Ctrl</kbd>.

Substitute for vim replace in Sublime

I'm looking for a replacement for vim's "replace with character" command--specifically, I want to be able to select some text and replace each character with some character that I type (difficulty: No "vintage" mode)
Example:
Starting with
I am some text with an arbitrary number: 12358998281
I want an easy way to select 12358998281 and turn it into 99999999999, to make the result
I am some text with an arbitrary number: 99999999999
(in vim, this would be done by moving the cursor to the beginning of 12358998281, selecting with ve, then pressing r9)
I can do this by selecting the text, bringing up the "find" dialog, making sure "in selection" and "by regex" are enabled, searching for ., then typing my character into the resulting multiselect. This is incredibly laborious, however, and it prevents me from doing this process on a multiselect (for example, if 12358998281 exists in multiple parts of the file, I might want to quickly replace all instances of it with 99999999999, rather than performing the process above, getting the substitution, copying it to the clipboard, and then replacing with that).
Does Sublime have a command that acts like vim's "replace" that I can bind to something, or do I have to write a macro to get what I need? Or, am I approaching this from entirely the wrong direction?
A more generalized way of thinking of this is "how can I break a select into a multiselect on all characters", if that helps.
By using this package https://sublime.wbond.net/packages/RegReplace you can create regex patterns and bind them to shortcuts.
Also if there are multiple occurrences of one word, you can put cursor on whatever part of the word and press CTRL+D multiple times. One CTRL+D press will select the word under the cursor, every other press will select next occurrence of the word.
You could also use https://sublime.wbond.net/packages/Expand%20Selection%20to%20Whitespace to expand the selection to whitespace if your word contain some random characters, and then press CTDL+D to select next occurrences of the word.
Edit: With the package regex shortcuts indeed you have to create regexes before binding them. But the CTRL+D does work without it.
I don't see a problem with using "Expand selection to whitespace" and than doing the CTRL+D as I wrote in the answer.
I've checked the usage of visual as you wrote in the question and this solution seems much faster to do. You don't have to place cursor in the beggining of the word as It can be whereever in the word and no find/replace is needed, since you'll multiselect all occurrences by holding CTRL+D for a sec and You'll be free to edit it.
You can also use https://sublime.wbond.net/packages/Expand%20Selection%20to%20Quotes to select text inside quote and combine it with CTRL+D if standard CTRL+D doesn't work with some text, or if select to whitespace selects too much text.
I ended up solving this with a simple (if inelegant) plugin:
import sublime_plugin
import sublime
class MultiSelectWithinSelectedCommand(sublime_plugin.TextCommand):
def run(self, edit):
selection = self.view.sel()
new_regions = []
for selected_region in selection:
if selected_region.empty():
selection.add(self.view.word(selected_region))
for selected_region in selection:
if selected_region.a > selected_region.b:
region_begin = selected_region.b
else:
region_begin = selected_region.a
for pos in range(selected_region.size()):
subregion_begin = region_begin + pos
subregion_end = subregion_begin + 1
new_regions.append(sublime.Region(subregion_begin, subregion_end))
selection.clear()
selection.add_all(new_regions)
Once I've stuck this in my plugins directory, I would bind a command in the keymap file like usual:
{ "keys": ["alt+f"], "command": "multi_select_within_selected" }
(with alt+f chosen arbitrarily), and lo, multi-select on all selected characters with a keypress (after which, I can press my replacement character).

Remove/Add Line Breaks after Specific String using Sublime Text

Using Sublime Text 2 - Is it possible to insert a line break/text return after a specific String in a text file e.g. by using the Find ‣ Replace tool?
(Bonus question: Is it possible to remove all line breaks after a specific String)
Here's how you'd do it on a Mac:
Command+F > type string > Control+Command+G > ESC > Right Arrow > line break
and Windows/Linux (untested):
Control+F > type string > Alt+F3 > ESC > Right Arrow > line break
The important part being Control+Command+G to select all matches.
Once you've selected the text you're looking for, you can use the provided multiple cursors to do whatever text manipulation you want.
Protip: you can manually instantiate multiple cursors by using Command+click (or Control+click) to achieve similar results.
Using the Find - Replace tool, this can be accomplished in two different ways:
Click in the Replace field and press Ctrl + Enter to insert a newline (the field should resize but it doesn't, so it is hard to see the newline inserted).
Inside the Find - Replace tool, activate the S&R regex mode (first icon on the left .*, keyboard shortcut is Alt + Ctrl/Cmd + R to activate/deactivate it).
Type \n in the Replace field wherever you want to insert a newline.
Both solutions also work if you want to find newlines, just do it in the Find field.
Edit->Lines->Join Line (Ctrl+J)
You should probably use multiple cursors. See the unofficial documentation, or this nice tutorial. Here's some brief instructions to set you on your way:
Put the cursor on the string of interest.
Type Command+D (Mac) or Control+D (Windows/Linux) to select the current instance of the string.
Type Command+D (Mac) or Control+D (Windows/Linux) to select successive instances of the string.
Alternately, type Control+Command+G (Mac) or Control+Command+G to select all instances of your string.
Now you have multiple cursors, so insert or remove your newline as you please.
(type esc to exit multiple cursor mode.)
Have fun!

Resources