When i double click on any word, ST highlights all other such words in file. Are there any combination to put cursor on each such word so that i can edit them at once (like after ctrl+f and then alt+enter - "find all")?
Ctrl + D several time or Alt +F3 :)
On a Mac, but I do CTRL + COMMAND + G to hightlight all the instances of the word.
Related
I have this task that I need to complete fast as possible. I have coupon codes (over 1000), I going to create an array out of it. To do that fast as possible I need to be able select multiples lines and edit them at the same time. I am using Atom as my editor choice. I tried to search online for answers but non found.
ST55672
SE82673
SS85074
SD65675
SH75676
to:
"ST55672",
"SE82673",
"SS85074",
"SD65675",
"SH75676",
PS. Im using Mac
1. Atom Commands
Select all text (Cmd+A on Mac, Ctrl+A elsewhere), then use the shortcut to “split the selection into lines” (Cmd+Shift+L on Mac, Ctrl+Shift+L elsewhere). Both commands are also available from the command palette.
PS: like many other keyboard shortcuts, these also work in Sublime Text
2. RegEx Search & Replace
Search for ^(.*)$ and replace with "$1",.
Notice for windows users:
multiline cursor works using these keys in the following order :
CTRL + ALT +
and ↓, or ↑, or a mouse "Click" any where you need
select all lines
Go to selection menu on the top bar (win & Linux)
select split selection into lines
I'm using Windows 8 x64, Sublime Text 3.
Here it is, I want to select all the variable with the same name in the file.
If I choose one of them, the one will be highlighted, all the others will be circled automatically, it's seems like Sublime text could recognize who is the word may be I want, even if they have the same word.
for example, if I choose num, ST will circle the word num but skip the word like num2 etc.
but neither I using ctrl+d or alt+f3, I couldn't just choose these variables safety - if there was other same word but not variable name in the code file. I just can't skip it. the num in num2 will also be highlighted.
Is there any way to choose the variables clean and safety like it been circled? or better, just choose the variables?
After asking myself the same question and searching lots and lots, I found the answer here on the official forum and here on SO (discarding results for ST2 wasn't that good of an idea after all ...)
Place your cursor on the word, without selecting it.
Press ALT + F3.
Or ...
Select the word,
In the Find menu, select Find... (CTRL + F),
Tick the Whole word option (Alt + W),
Press the Find All button (Alt + Enter).
When I'm editing HTML or CSS in Sublime Text 3 the lines auto-indent when I hit the [ENTER] key, which generally is very useful.
On occasion I find myself wanting to paste a line of markup which is already indented, and this results in double indentation.
Is there some other key combination along with the [ENTER] key that prevents the next line from auto-indenting and instead returns the curson to the very beginning of the line? Please note I don't want to turn off auto-indent on a global basis.
You can do it in various steps, using various keybindings, so you can simply record a macro and do it in one simple custom keybinding (tools > record macro).
Steps:
Press [Enter] to move to a new line.
Press [shift+home] to select until the beginning of line (spaces or tabs used to indent).
Press [backspace] to remove the selected indentation charaters
You're done. Stop recording and save the macro, then use a custom keybinding to do it in a single step.
I found in Windows that CTRL + SHIFT + V (rather than just CTRL + V) does a "paste and indent" whereby the indentation is corrected as necessary.
It's also possible to switch the default paste for paste as indent as per these instructions: https://gist.github.com/twosixcode/1988097
I was wondering if there is a shortcut to Paste from the clipboard & at the same time cut the selection to be pasted somewhere else.
Elaborating the Question:
I find myself often swapping values among various sections of code. As a primitive example:
var a = "two";
var b = "one";
To swap them, I would:
cut the value of a
Paste it next to the value of b
cut the original value of b
paste that back as the value of a
I was wondering id there is a shortcut to combine step 2 & 3 of this process.
Sublime Text provides a tool for doing exactly(?) what you wish.
Double click "one" (to select it)
Hold ctrl and double click "two" (both are selected now)
press ctrl + t to swap selections
Otherwise you may wish to register a new key binding for your custom operation. You can do this via Preferences -> Key bindings (User).
Use Permute Selection > Reverse:
highlight two value
hold control
highlight one value
Edit > permute selection > reverse
Not exactly, but something is kinda there to help in such situations. There is a Clipboard History built-in Sublime Text (atleast in 3, not sure 2). Just copy the text you are replacing, then press <C-k><C-v>. This will popup a small window with clipboard's history. Select the previous copied text to replace currently selected text.
This option is available under Edit -> Paste from History.
HTH
You can do it too with a clipboard history https://github.com/colinta/SublimeClipboardManager
Copy: oneCopy: twoPaste-previous in twoPaste-next in one
The good thing is that clipboard history can be helpful in more situations
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