How can I do a column select across the entire file? - sublimetext2

Is there a way I can use the middle click or maybe (Ctrl+Alt+Up) to a particular column across all lines in a long file? Currently, I am middle-clicking and then dragging this to the end of the screen and waiting for it to select all lines.
Specifically, for long files, how would I select one particular column across the entire file?

This should do it:
Ctrl+A - select all.
Ctrl+Shift+L - split selection into lines.
Then move all cursors with left/right, select with Shift+left/right. Move all cursors to start of line with Home.

OS X
You can click the following and drag to create a selection of one or more columns of characters:
Left mouse button + option
Middle mouse button
To add to an existing selection, hold command while doing the above.
To subtract from an existing selection, hold command + shift while doing the above
Windows
You can click the following and drag to create a selection of one or more columns of characters:
Right Mouse Button + shift
Middle Mouse Button
To add to an existing selection, hold Ctrl while doing the above.
To subtract from an existing selection, hold Alt while doing the above.

In Mac OS X, replace Ctrl with CMD key. So it'll be,
CMD+A - select all.
CMD+Shift+L - split selection into lines.
Then move all cursors with left/right, select with Shift+left/right. Move all cursors to start of line with Home.

Related

Sublime Text 3 Incremental Selection

I want to know is there an analog command in Sublime to Pycharms Cmd(Ctrl)+W?
This is what she does in Pycharm:
Press Ctrl+W to select the word where the caret is currently located.
Press Ctrl+W successively to extend selection to the next containing node (for example, an expression, a paired tag, an entire conditional block, a method body, a class, a group of vararg arguments, etc.)
While extending selection, keep in mind the following:
Pressing Ctrl+W successively in plain text or comments extends the selection first to the current sentence, then to the current paragraph.
Pressing Ctrl+W successively inside a list, dictionary, or a list of arguments or parameters, selects an element of the list, then the right or left comma and a neighbouring space (if any), then the contents of the list without parentheses, and finally the enclosing parentheses.
Press Ctrl+Shift+W to shrink selection in the reverse order (from the outermost container to the word where the caret currently resides).
Tip
The selection extends or shrinks according to capitalization, if the Use "CamelHumps" words is enabled on the Editor. Smart Keys settings page.
If you want to make selection according to capitalization, using double-click, make sure that the option Honor CamelHumps words... is selected on the Editor settings page.
Without using a plugin:
Expand selection to scope (Ctrl + Shift + Space / CMD + Shift + Space)
Expand selection to brackets (Ctrl + Shift + M / Ctrl + Shift + M)
Expand selection to indentation (Ctrl + Shift + J / CMD + Shift + J)
There is ExpandRegion plugin, which you can install using Package Control. I just tried it and it's pretty good. However I did not find an option to shrink the selection (only expand), but I may have overlooked it.
If you use it, you will also need to define your own keybinding for the command. Description on how to do that is in README.md file on the plugin's GitHub page.

How to use multiple cursors efficiently in this case?

The stage is set: I'm about to add three li s to an ul and I think it would be a good application of multiple cursors in ST2. I'm not sure how to do this.
At step 1. what I'd really like to be able to do is: "open 2 new lines with 2 new cursors". I don't think it possible to do that so instead I tried opening 2 new lines manually (step 2) and than applying multiple cursors using ctrl+shift+up except then the cursors end up in a not-so-ideal spot (step 3).
Even if I hold cmd and click the cursors end up in the same not-so-ideal spot (step 3). So my question is how can I efficiently apply multiple cursors to my situation?
Trying Harpreet's technique doesn't seem to work for me:
Edit
Earlier Answer
After your Step 3
Press Upper Key Arrow
Press Down Key Arrow
Use tab key to go to proper position
type li (s)
When you end up in what you call not-so-ideal spot, press the 'Home' button twice on your keyboard, you'd be taken to the start of each line, then press tab four times to go to your 'ideal spot'.
I think this is an open-ended question.
In your very first attempt, if you replace two of the enters by ctrl+shift+d (duplicate_line), you will find when you do multi cursor up (select_lines), it will give you the positioning you wanted.
The cause of your problem is that your original three empty lines aren't actually the same (due to whatever indentation mechanism). And the best way of using multi-cursor is using them on structurally identical lines.
Of course in practice, it all depends on where your cursor currently is. For example if I am near the other < li >s, I might actually ctrl+shift+d (duplicate_line) a few times until I get 3 new < li >s before I ctrl+shift+down (swap_line_down) a few times to get them into that < ul >.

Sublime Text: Multiple Select in a Selection

I want to do multiple select and edit within a specified selection in Sublime Text 2. The following screenshot illustrates the situation:
When I select "element" and press Alt + F3 (in Windows) I can simultaneously edit all instances of element. However what I would like to do is to be able to edit all instances of element only within container-a while leaving element within container-b untouched. I tried first selecting a specific area but then as soon as I attempt to select "element" my first selection disappears.
Is this possible to achieve in Sublime Text 2?
You can simply use the Find in Selection option in the Find panel. Select the text that you want to search in:
then hit CtrlF to open the Find panel. Type in the text you want to find (such as element), then, in the group of buttons to the left of the text area, click the second button from the right - In Selection (highlighted in red):
Finally, either hit AltEnter or click Find All to select all the instances of element in the selected area:
and you're good to go.
Press Ctrl+D to select one more element and then one more again until you have selected all elements in container-a.
(Sorry my approach is very similar, but just a tiny thing to make it very slightly faster.)
Before you start, have the setting "auto_find_in_selection" to true, (This is probably only for SublimeText 3). This will have the "In Selection" button automatically done in most cases.
(if you are already under the word) use Ctrl+E (command slurp_find_string). This causes the word to be used in find box.
select the region you want (Ctrl+Shift+J should work nicely in your case)
Hit Ctrl+F, you will find all settings are right ("In Selection" on, your word in box already)
Just hit Alt+Enter and you are there.
For Mac, select what you want and then you can use --> cmd+ctrl+g

How to I edit the select lines with the arrow keys command in Sublime Text 2?

I'm trying to find out what the setting is for the way Sublime Text handles code selection with the keyboard.
Example:
Hold Command + Shift + < or > to highlight a line
Next if you then click up or down, it will select everything above or below
Ideally I'd like to just continue selecting lines up or down, line by line rather then the whole thing.
Anyone know how to edit that feature?
CMD + L selects the cursor's line.
Then SHIFT + UP / DOWN adds the previous / next line to the selection.

ST2 -- split_selection_into_lines -- left side of block

Is it possible to split_selection_into_lines at the left side of the block, instead of the right?
It would be nice to select several lines (in one fell swoop) and then type something that will precede each line. I have been using the command+left-click for the left-hand margin, but it is difficult to know whether each line has actually been selected because each line is vertically aligned (e.g., flush-left) -- it is also time consuming to select each line manually.
A simple way is to just find-replace, and replace a delimiter with "\n [text that precedes this line]"
After selecting "split_selection_into_lines" (ctrl+shift+l), the keyboard shortcut command+left-arrow moves multiple cursors the left side of the highlighted block.
Alternatively, holding down the option(alt) key and holding down the left click on the mouse lets the user select everything within a vertical line that is defined by moving the mouse up or down.
https://tutsplus.com/lesson/multiple-cursors-and-incremental-search/