Looking at the documentation
To go from multiple selections to a single selection, press Escape.
However, this always takes me to the first selection, I would like to go to the last selection, is there a plugin or command for this?
Install Sublime-MultiEditUtils and press shift+esc to jump to last region.
Related
The functionality "Quick Add Next" is handy, however there is one problem, that after it reaches the last match in the file, if I do it again, it will go on to include the first match in the file also (wrap), which is not what I want, because it's usually hard to realize whether you've reached the last match or not. This occurs even if the option "wrap" is disabled among search options. Is there anyway to disable it?
If no, is there a way to unselect the match I just added by "quick add next"? That would be a valid alternative. Thanks.
Quick Add Next has the keyboard shortcut ⌘D on Mac, CtrlD on Windows/Linux. If you want to skip a selection, hit ⌘K,⌘D (CtrlK,CtrlD) - meaning, hold down the ⌘ (or Ctrl) key, hit and release K, then while still holding down ⌘, hit D.
There is no way that I know of to disable the "wrapping" feature, but if you go too far and want to back up, hit ⌘U (or CtrlU), known as soft_undo, as many times as needed to go back to where you want to be.
I need to change occurrences of a term only in certain places in my project.
Is there a way in Sublime Text to navigate the search results (across an entire project) and only replace the occurrences of my choice?
⌘ShiftF opens the "search and replace" for the entire project, but the Replace button only gives me the option to replace all occurrences.
If you press the ... button in the search panel, a menu will open that allows you to refine your search. You can use the Where input field with a search pattern, or some tags like <open-files>.
http://docs.sublimetext.info/en/latest/search_and_replace/search_and_replace_files.html
Other than that, if you really need human input to decide where to replace and where not to replace, you can go to the next result by pressing Enter and pasting the code manually.
Just in case you didn't know: when you make a project search a new text file opens up with all the occurrences. You can click those occurrences to navigate to the file in question.
For posterity, the functionality to search/find and replace inside the open project does exist. ⌘ShiftF and add <open project> to the Where input field.
In most other editors, I can select a portion of the text I want to run find and replace on and then hit the ctrl + h combination. A screen pops up asking me what to find and what to replace. How do I do this in PHPStorm?
If you are using the Default keymapping (you can also use the keymaps for Eclipse, Visual Studio, etc) press Ctrl+r to show the Replace Toolbar. If you already have a selection then the option In Selection will already be checked, otherwise you can check it and then do your selection (if you select first and check the option second it will unselect the text after checking the option).
The feature is called Replace in the Keymap configuration if you wish to change the shortcut.
You can also press Shift+F6 to directly rename variables if that's what you want to do.
Highlight the code selection you wish to work on
( you can use alt + arrow up if your looking for a cool way to do that)
Press Ctlr + r on PC or Command + r on a Mac
In the upper options window, insert the values you wish to replace
Select the "in selection" check box
Press Replace/Replace all button
I am in need of being able to select multiple cursors for thousands of lines that would then let me add content before each of them at the same time. Is there a way to select all and then select the multiple cursor option to put the cursor before each character of each line? Hope that does not sound confusing :-(
On Windows / OS X
Make sure you have View > Word Wrap off
Select all: Ctrl / Cmd+A
Split into Lines:Ctrl / Cmd+Shift+L
Put the cursor at the beginning of the line: Home / Ctrl+A
Yes, though I don't know how well multiple selections works with thousands of lines.
Start with Select All or select the lines that you need to edit.
From the Selection menu -> Split into lines. This will create multiple selections, one for each line.
Move the cursor to the beginning of each line by using the Home key.
Insert your content.
You can do as was suggested in other answers, it will work perfectly fine, sublime can handle thousands of selections for sure, but it might get bit slow sometimes.
Use regex in search n' replace, that's what it's for.
ctrl+h opens search and replace tab
make sure "Regular expressions" is pressed, "wrap" is pressed and "in selections" is NOT pressed.
type ^ to top field, it will mean "beginning of line" in this context
type your text in bottom field
ctrl+alt+enter or whatever the shortcut is to "replace all"
How do I list the lines that contains the matches from the "find" command ? ie., I would like to list all the matching lines in a separate window. Currently one can only goto next / previous 'find'.
Try 'Find in Files' (Cmd+Shift+F on a Mac, presumably Ctrl+Shift+F on a PC).
Search results will display in a new tab, and you can double-click any result to jump to that line in the matching file.
To search only open files, put <open files> in the Where field.
To show only the lines that matched without surrounding lines for context, toggle the 'Show Context' option (to the left of the 'Find All' panel).
1.Here is a reference: How can I filter a file for lines containing a string in Sublime Text 2?
Hit Ctrl+F(⌘+F) to "Find All" occurences;
Hit Ctrl+L to Expand All Selection to Line.
Then you can Ctrl+C(⌘+C) or Ctrl+Shift+K(⌃+⇧+K) to
copy/delete the lines.
2.There's now a plugin for filtering lines:
https://github.com/davidpeckham/FilterLines
It allows filtering and code folding based on strings or regular expressions.
I think the simplest way is just to search for the line like this -> ".*find_this_string.*" and make sure that regular expression is ticked. Then you can click "find all" (alt+enter) and just copy and paste all results to a new window.